Tuesday, January 5, 2010

Simple hibernate.cfg.xml file example

Here I'm giving an example to right a simple hibernate.cfg.xml file.



<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- jdbc connection properties -->
<property name="hibernate.connection.datasource">myDataSourceName</property>
<property name="connection.driver_class">properDriverForDatabase</property>
<property name="connection.url">databaseURL</property>
<!-- for example : jdbc:oracle:thin:@myHost:port:orcl-->
<property name="connection.username">user</property>
<property name="connection.password">password</property>
<property name="show_sql">true</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>

<mapping resource="path/to/the/hbmXml/file/fileName.hbm.xml">

</session-factory>
</hibernate-configuration>

We will see in coming posts about the mandatory properties and optional properties and what they stands for.

No comments:

SpringBoot: Features: SpringApplication

Below are a few SpringBoot features corresponding to SpringApplication StartUp Logging ·          To add additional logging during startup...