So we are getting rolling with Hibernate in earnest and digging it.
i'm a newbie also, but it looks wonderful
> We are defining our data model with mapping files and generating everythign else (Java classes and SQL) from the mappings. ....
i am using middlegen to reverse a bunch of leagcy mysql 3 db's with no relational info, but if it is put in we get ...
>The problem, though, is that the generated Java classes are plain old beans.
well, you do get those Sets which look *wonderful* - so you have a bunch of structure than you the pojos's hang on.
>Now we are getting to the point where we want to add domain model logic to the domain objects.
me too.
>The question is, how can we add domain logic (more methods, invariants in setters, etc., etc.) to the domain objects, and still maintain the very nice property that the domain objects are auto-generated by Hibernate? ...
boss wants a dao, being an oo bigot that's fine with me as it removes a dependency
> Right now we are defining separate DAO classes (which tend to be mostly static methods! too procedural! we're missing something here!) that perform operations on the domain objects.
that's usually a bad code smell.
> In other words, we are implementing operations (finder operations, multi-object updates, etc.) in separate helper classes which are in a layer above the domain model. ...
wouldn't these tend to go inside the dao layer like in
http://www.ociweb.com/jnb/jnbNov2003.html?
> This is good on the one hand because it keeps Hibernate-specific code out of the domain model (i.e. the Hibernate-generated POJOs), but on the other hand it's bad because we want some of this logic to be in the domain model.
i'm not quite there yet, but i wil be as all of our logic and sql is in a bunch of 1000 line servlets :( - the trick seems to be to figure out what goes in the dao beside crud++, what goes in the domain model and what goes in the service layer for each app.
>Ah me, can you tell it's our first time designing a tiered enterprise system?!
me too :(
thanks