Wednesday, May 28, 2003


Hibernate Again.

I'll go ahead and register some frustration with Hibernate.  I've been trying to use it without diving into the source, but I think it's just about unavoidable at this point.  My model has some tricky bits in it that just seem to defy mapping.  They're pretty simple in Java Object terms, but when you are trying to condense it down to relational stuff, things get a bit twisty.

I've got a Project class, that has a set of Categories.  Each Category can have sub-Categories.  Simple, no?  Well...with Hibernate 2 I just seem to be missing something.  I can get it to see all my objects, save them all, but when they come back in the parenting of the subcategories is all screwed up.  I obviously have that part of the mapping wrong.  I'm trying to follow quite precisely the instructions provided in the parent-child faq -- the difference is that my categories are both parent and child, and that N categories don't actually have any parent at all.  Those are parented by the Project object.

I guess I'll crack it eventually.

It's cool how Hibernate goes for the minimal possible mapping of things.  I wish that it had some way of explaining itself as it is generating the schema -- why does it do this, or that? 


2:12:45 AM