|
Hi,
I'm new to Hibernate. To familiarize myself, I made a small test application that uses two database tables with a one-to-many relationship. I read Hibernate in Action, and followed most of their examples verbatim. My relationship is mapped using an "idbag" tag with lazy set to "false".
The good news is, my test application works fine. It does exactly what I expected with regard to what ends up in the database.
However, I have a couple of concerns about performance after viewing the SQL that Hibernate generates:
(1) I did a delete using a query string -- session.delete("from x in class League where x.key='TEST'"). I expected this to issue one SQL statement to the database. Instead, it issues several statements, one for each row that matches the condition.
(2) I expected Hibernate to use some sort of join to satisfy the one-to-many mapping between two tables. Instead, what I see in the log is that every time I get an object Hibernate issues two SQL statements, one to get the object from the first table and one to get the dependent records from the 2nd table.
(3) If I update one property of a persistent object, Hibernate issues an UPDATE statement for all the properties, not just the one I changed. I was expecting it to be smart enough to only update the changed property.
These aren't necessarily huge issues but there are some in my organization who are skeptical of O/R mapping tools and will want me to be able to explain these behaviors.
I'm using an Oracle 8 database and I do have the Hibernate dialect appropriately set to net.sf.hibernate.dialect.OracleDialect. I can post more details if necessary but I figured that since I'm new at this, someone might have some answers readily at hand. Thanks.
Frank
|