O'Reilly logo

Spring Persistence with Hibernate by Ahmad Seddighi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring Hibernate

As you saw in Chapter 3, you must configure Hibernate before you can use it. The configuration is represented by an object of type org.hibernate.Configuration. This object wraps all of the configuration settings and is used in the next step for building a SessionFactory object. (We'll discuss a useful strategy for creating the SessionFactory at the end of this chapter.) To configure Hibernate, you first need to instantiate a configuration object:

Configuration cfg = new Configuration();

The actual configuration settings can be divided into two parts:

  • Hibernate properties: These include all of the database-related properties that Hibernate should consider while connecting to the database, as we saw earlier.
  • Hibernate mappings: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required