
Chapter 4 Generating Hibernate Persistent Objects and JSF Pages
Defining generation options
There are several types of generation options:
- Environment variables - to allow your Eclipse or Ant build script to find the Hibernate library Jar files
- Hibernate configuration
- Generation options
To define environment variables:
- Select Tools→Generation Options
- Select the Variables node
- Add a variable HIBERNATE_HOME and, in the value field, enter the Hibernate home directory path. For example, D:\Hibernate-3.0.
To define Hibernate configuration options:
- Open the model property sheet and click the Hibernate Configuration tab:
- Select the target database type in the dialect list.
- 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.
- Enter the JDBC connection URL for your database.
- Enter the JDBC driver Jar file path. You can use the Browse button to find the file.
- [optional] Enter the default database connection user name and password.
- [optional] Add a package prefix, for example, com.mycompany.
To define generation options:
- Select Language→Generate Java Code.
- Specify the root directory where you want to generate the code.
- Click the Options tab.
- [optional] To use DAO, set the Generate DAO sources option to true.
- [optional] To use Eclipse to compile and test the Java classes, set the Generate Eclipse project artifacts option to true.
- [optional] To use unit test classes to test the Hibernate persistent objects, set the Generate unit test sources option to true.
- 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.
|
|