Category Archives: Hibernate

Hibernate and Composite keys

I like using surrogate keys for most of the database designs for the following reasons: Simplifies design and may improve efficiency Maintainability: Change to the meaning of the natural key could change the table structures when using natural keys Natural … Continue reading

Posted in Hibernate, Java | Tagged , , | 2 Comments

Hibernate direct field acess and encapsulation

I am a big fan of the Hibernate’s direct field access functionality. I am not sure why ”property” access is the default instead of “field”. Direct field access allows me to control the number of getters/setters that are actually needed from the DAO Client’s perspective. … Continue reading

Posted in Hibernate, Java | Tagged , , | 1 Comment

Using Hibernate and Jdbc DAOs in the same Transaction

I think it is very hard to build any enterprise application without using at least a little bit of straight Jdbc. Even if an application uses Hibernate heavily, there will be situations where using straight Jdbc makes most sense. We use HibernateDaoSupport (using GenericDAO pattern) and JdbcDaoSupport Spring … Continue reading

Posted in Hibernate | Tagged , , | Leave a comment

Override Hibernate SQL Types mapping

There are many real-world scenarios where Hibernate can be introduced on a legacy system that could be using straight JDBC for various reasons. Also, there could be some pre-existing custom Java types to Database type mapping in the legacy application. Hibernate has … Continue reading

Posted in Hibernate, Java | Tagged , , | 3 Comments

Hibernate and DB migration

I am working on a product that uses Hibernate that required DB (schema and data) migration, like most Enterprise Software. Hibernate’s schema create/update feature (using hibernate.hbm2ddl.auto property) has it’s limitations. Also, certain complex DB migration requirements will definitely require custom … Continue reading

Posted in Hibernate, Java | Tagged , , , | 9 Comments