Following the theme of other threads.
What are your most favorites tricks or techniques involving Hibernate?
My favorite is binding non-Hibernate generated classes to existing classes with additional functionality (i.e. summarization).
Following the theme of other threads.
What are your most favorites tricks or techniques involving Hibernate?
My favorite is binding non-Hibernate generated classes to existing classes with additional functionality (i.e. summarization).
I almost always generate my classes from the HBM files and to get my domain objects with property change listeners I have made my own FreeMarker templates that adds property change support.
Please-please read Hibernate In Action. Although it's about Java version, it will give you a solid knowledge of what as ORM is all about, what problem it solves, where it's appropriate and where's not.
And, in line with previously said, evaluate if NHibernate is the best tool for the job.
Second level caching. It dramatically improve the performance of the application for data that does not change (constant for example), while maintaining database integrity: you don't store constants as string in a column, but in a separate table bound by foreign key.
Additionnally, the second level caching can be shared across multiple web server!
Editing hibernate configuration programmatically :) The dom4j entity mode.