img
.
Property
Description
Indicates whether Hibernate should output the SQL queries to the log file
hibernate.show_sql
or console. You should turn this on in a development environment,
which can greatly help in the testing and troubleshooting process.
For the full list of properties that Hibernate supports, please refer to Hibernate's reference manual
(http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/session-configuration.html).
ORM Mapping Using Hibernate Annotations
Having the configurations in place, the next step is to model the Java POJO entity classes and their
mapping to the underlying relational data structure.
There are two approaches to the mapping. The first one is to design the object model first and then
generate the DB scripts based on the object model. For example, for the session factory configuration,
you can pass in the Hibernate property hibernate.hbm2ddl.auto to have Hibernate automatically export
the schema DDL to the database. The second approach is to start with the data model first and then
model the POJOs with the desired mappings. We prefer the latter approach, because we can have more
control on the data model, which is very useful in optimizing the performance of data access. Based on
the data model, Figure 9-5 shows the corresponding OO model with a class diagram.
Figure 9-5. Class diagram for the sample data model
You can see there is a one-to-many relationship between Contact and ContactTelDetail, while
there's a many-to-many relationship between the Contact and Hobby objects.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home