Chapter 4 Generating Hibernate Persistent Objects and JSF Pages


Hibernate Overview

Hibernate is an open source project developed by JBoss, which provides a powerful, high performance and transparent object/relational persistence and query solution for Java.

Hibernate lets you develop persistent objects using POJO (Plain Old Java Object). All the common Java idioms, including association, inheritance, polymorphism, composition, and the Java collections framework are supported. Hibernate allows you to express queries in its own portable SQL extension (HQL), as well as in native SQL, or with Java-based Criteria and Example objects.

PowerDesigner supports the design of Java classes, database schema and Object/Relational mapping (O/R mapping). Using these metadata, PowerDesigner can generate Hibernate persistent objects including:

The following use cases are supported:

Steps To generate persistent objects for Hibernate:

  1. Create domain specific Java classes as usual.
  2. Define O/R mapping.
  3. Define Hibernate persistence options.
  4. Generate Java code.
  5. Compile the Java classes.
  6. Run Hibernate unit tests and use JSF web pages to test Hibernate objects.

Steps To use Hibernate persistent objects in your application:

  1. Create a SessionFactory.
  2. Connect to database.
  3. Begin a transaction.
  4. Work with the Java classes as usual (find objects, create new objects, modify objects, delete objects, etc.).
  5. Commit the transaction.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.