Hibernate version: 2.1.6
Name and version of the database you are using: Postgres
My team and I are trying to decide b/w using hibernate or JDBC/SQL, one question we keep hitting upon, that I don't have an answer for yet, is about updating an object.
Say I have an object A that has a one-to-many relationship with object B...
If using JDBC/SQL and I was adding a new object B to the set that object A has, it would require one SQL statement say "insert into tableB (col1, col2, "objectid of A") values (?,?,?)"....
Now doing this in hibernate would require first having to fetch objectA (that's one SQL select), then access the set of object B's (another select) and then add the new object B to the set and save object A (an SQL insert)
So, is there a better way to do this in hibernate that would elimnate the performance hit of these extra SQL statements?
thanks in advance!
|