Hibernate configuration files

hibernate.properties and hibernate.cfg.xml perform the same configuration functions, if hibernate.cfg.xml exists it takes precedence over hibernate.properties.

The configurations can include Datastore, SessionFactory, Connection Pool, Transactions, and Cache Provider.

Much if not all of this can also be specified in the persistence.xml and the *-ds.xml.

Generally the persistence.xml specifies only the persistence unit name, jndi-name, mode (create, drop, etc.) for an EE application and everything in a standalone application.
Generally the *-ds.xml specifies the data source connection parameters, jdbc url, driver class, credentials, connection test parameter, provider type (Oracle, MySQL, etc.).
Generally the hibernate.cfg.xml specifies the others.

hibernate.cfg.xml is placed in WEB-INF/classes
persistence.xml is placed in META-INF in jar with entity beans


Hibernate Quickly

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout