The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

ORM question

Hello, does an ORM imply that the system is able to generate SQL on the fly based on some description of table relations?

Thanks.
MyNameIsTony0
Monday, January 07, 2008
 
 
BTW With "table relations" I mean "table associations".
Thanks.
MyNameIsTony0
Monday, January 07, 2008
 
 
Basically yes... the description could be in a separate file or it could be done using some simple assumptions and/or annotations. Different ORM's have different methods, check out Hibernate's web site for more details (IIRC, they use the separate-file method, but I might be mistaken).

This thread makes me want to rant about the inadequacy of DB access in most mainstream development platforms, but I don't have the energy for it.
Greg Send private email
Monday, January 07, 2008
 
 
For example, I wrote a code generator creates code that maps Table structures to Classes. However there is no runtime check of the object structure and the SQL is.

A basic usage of this code would be

Person p = new Person ("Jackie");
PersonDB pdb = new PersonDB ();
pdb.insert ( p );

And the insert method knows the structure of the table and uses the object from the parameter to put the values in the SQL query.

Isn't this a kind of ORM, since it maps between OO and Relational? Thanks.
MyNameIsTony0
Monday, January 07, 2008
 
 
What you've written is essentially what most ORM frameworks do.
Stephen Caldwell
Monday, January 07, 2008
 
 
There is no list of features that an ORM must implement. Some ORM packages do generate SQL on the fly, some don't.
Wayne Bloss Send private email
Monday, January 07, 2008
 
 
I think an ORM is supposed to "map your objects into tables". Instead of reading table scheme data, it should generate/update tables and their relationships from your classes, and convert your object-querying language/whatever into SQL.

An ORM that reads db schema and generate common SQLs is simply NOT an ORM.
AqD Send private email
Monday, January 07, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz