I am so frustrated using Hibernate. Spring JDBC is so much easier and it actually WORKS! In Hibernate, a simple OneToMany relationship does not work. I have a simple parent child relationship. Say a box which can contain other boxes. If i try to load all the boxes which do not contain other boxes, i get a List of Box Objects which duplicate entries because it is returning a row for each contained box.
To work around this bug, which no one on the Hibernate forums even will respond to my request for help, i have to set the children to load lazily then manually iterate over the parent boxes to load the children. How stupid.
The next bit of fun was moving a object out of a Collection on one Object to another. What is a simple SQL statement turned into a two day Google and hacking to make work right.
This is in addition to having to work around with all the proprietary mappings and HQL nonsense. Why use this stuff when SQL exists, is very simple to use, and extremely robust? In the end, you write your "complex" queries yourself via the mentioned proprietary HQL or even gasp...SQL from Hibernate.
If i did not need Hibernate Search on this project i would ditch Hibernate in a second in favor of Spring JDBC.
Wednesday, April 7, 2010
Subscribe to:
Posts (Atom)