Ok, here's an update:
I execute the following code:
List rootThemes = session.find("from com.tog.desktopbeautifier.shared.Theme where parent_id is null");
rootThemes = session.find("from com.tog.desktopbeautifier.shared.Theme where parent_id is null");
Hibernate dies on the second line (which is identical to the first line) because all of a sudden, Theme.name="" and Theme.parent_id="NULL" in the database. In other words, for some unknown reason, session.find() is alternating values inside the database (!!). This shouldn't be!
I can provide you with the sources for Theme and information about my underlying database. Can you please let me know what could possibly be causing this?
For line one, Hibernate generates the following code:
Hibernate: select theme0_.id as id, theme0_.name as name from theme theme0_ where (parent_id is null )
Hibernate: select children0_.id as id__, children0_.parent_id as parent_id__, children0_.name as name__, children0_.id as id0_, children0_.name as name0_ from theme children0_ where children0_.parent_id=?
Hibernate: select children0_.id as id__, children0_.parent_id as parent_id__, children0_.name as name__, children0_.id as id0_, children0_.name as name0_ from theme children0_ where children0_.parent_id=?
Hibernate: select children0_.id as id__, children0_.parent_id as parent_id__, children0_.name as name__, children0_.id as id0_, children0_.name as name0_ from theme children0_ where children0_.parent_id=?
Hibernate: select children0_.id as id__, children0_.parent_id as parent_id__, children0_.name as name__, children0_.id as id0_, children0_.name as name0_ from theme children0_ where children0_.parent_id=?
For line two, Hibernate generates the following code:
Hibernate: update theme set parent_id=null, name=null where parent_id=?
The second command is obviously what is clobbering values in the database. The question is, why is Hibernate generating this? Any ideas?
Gili
|