Member Menu
 
 Monthly JBoss newsletter:
 
Java Persistence with Hibernate
CaveatEmptor

Development Process

Hibernate is process-agnositic. An XML mapping document decouples your Java object model from the underlying database schema and model. Alternatively you can use XDoclet or EJB3/JSR-220 persistence annotations to define your mapping metadata.

Any of the following development scenarios are supported:

Top down

  • implement a Java (JavaBeans) object model
  • write a mapping document by hand, or generate it from XDoclet tags, or use JDK 5.0 annotations
  • export the database tables using the hbm2ddl (SchemaExport) tool

Bottom up

  • start with an existing data model
  • use the Hibernate Tools to generate the mapping documents (or annotated Java source)
  • use the hbm2java (CodeGenerator) tool to generate skeletal Java code
  • fill in the business logic by hand

Middle out

  • express your conceptual object model directly as a mapping document
  • use the hbm2java tool to generate skeletal Java code
  • fill in the business logic by hand
  • export the database tables using the hbm2ddl tool

Meet in the middle

  • start with an existing data model and existing Java classes
  • write a mapping document to adapt between the two models (you may require some minor refactorings of the object and / or data models)
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]