Chapter 4 Generating Hibernate Persistent Objects and JSF Pages


Defining generation options

There are several types of generation options:

Steps To define environment variables:

  1. Select Tools→Generation Options
  2. Select the Variables node
  3. Add a variable HIBERNATE_HOME and, in the value field, enter the Hibernate home directory path. For example, D:\Hibernate-3.0.

Steps To define Hibernate configuration options:

  1. Open the model property sheet and click the Hibernate Configuration tab:
  2. Select the target database type in the dialect list.
  3. Select the JDBC driver class name for the target database. If the driver class name of your database is not in the list, you have to enter it manually.
  4. Enter the JDBC connection URL for your database.
  5. Enter the JDBC driver Jar file path. You can use the Browse button to find the file.
  6. [optional] Enter the default database connection user name and password.
  7. [optional] Add a package prefix, for example, com.mycompany.

Steps To define generation options:

  1. Select Language→Generate Java Code.
  2. Specify the root directory where you want to generate the code.
  3. Click the Options tab.
  4. [optional] To use DAO, set the Generate DAO sources option to true.
  5. [optional] To use Eclipse to compile and test the Java classes, set the Generate Eclipse project artifacts option to true.
  6. [optional] To use unit test classes to test the Hibernate persistent objects, set the Generate unit test sources option to true.
  7. Click on OK to generate code immediately or Apply and then Cancel to save your changes for later.

 


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