Friday, May 8, 2009

Customize Hibernate Mapping Strategy

You can use Hibernate reverse engineering tools to create mapping files and Java classes. However, the default mapping may not always fit your need. For example, it maps table primary key to BigDecimal and uses "assigned" generator. You can add customization in hibernate.reveng.xml to change that. Here is an example of how to map PK to Integer with sequence generator. You can also define "type-mapping" for global type mappings.

No comments:

Post a Comment