|
|
|
|
|
by jawher
5389 days ago
|
|
It's not just the SQL. There's also the mapping code between your objects and the SQL. for instance, for a select query: select first_name, last_name, login, email from users where id = 5;
Depending on the language and ORM you use, you'll need to write code that resembles this: result = execute(query);
User u = new User();
u.firstName = result.get("first_name);
u.lastName = result.get("last_name);
u.login = result.get("login);
u.email = result.get("email);
The mapping part may also involve data conversion between SQL types and you language types.The same also applies to the other direction: when you want to generate an SQL query that updates/inserts an object of yours into the database. ORMs also handle (I didn't say well) relations between objects (1..1, 1..n, n..n). |
|