Java Reference
In-Depth Information
The reversestrategy attribute allows you to specify the fully qualified class name of
a custom implementation of the org.hibernate.cfg.reveng.ReverseEngineeringStrategy
interface. This interface defines methods that can be used to select the following:
Class names from table details
Property names from column details
One-to-many associations from foreign key relationships
Many-to-one associations from foreign key relationships
Inverse relationships from foreign key relationships
Lazy loading details from foreign key relationships
Collection attribute names from foreign key relationships
Entity names from foreign key relationships
Tables and columns to include and exclude
Primary key columns from table details
The column to use for optimistic locking strategies
Composite ID details from table details
It also allows you to provide information about how schemas should be generated from
the resulting metamodel. This information is as follows:
Additional foreign key relationships
The table naming strategy to be used
The disadvantage of this approach to managing the reverse engineering process is that it is
not particularly flexible, and it requires a lot of coding. Reverse engineering is often carried out
only once to establish the mappings, with the schema thereafter being driven from the map-
pings, rather than being used to create them. The Hibernate tools therefore provide a second
mechanism for controlling the reverse engineering process by specifying an XML configuration
file using the revengfile attribute of the <jdbcconfiguration> task. This provides nearly the
same degree of control, but is much simpler to create—especially if you intend to manipulate
only minor details of the process.
The output of the reverse engineering tool described in the “The Reverse Engineering and
Code Generation Tools” section is actually a reverse engineering XML file following this for-
mat. A very simple example reverse engineering file is shown in the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"
>
Search WWH ::




Custom Search