Hibernate config for JNDI datasource


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-configuration PUBLIC
  3. "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  4. "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  5.  
  6. <hibernate-configuration>
  7.  
  8. <session-factory>
  9.  
  10. <!-- Use a Tomcat 5.5 JNDI datasource -->
  11. <property name="connection.datasource">java:comp/env/jdbc/Sampdb</property>
  12. <property name="show_sql">true</property>
  13. <property name="dialect">org.hibernate.dialect.MySQLDialect </property>
  14. <property name="current_session_context_class">thread</property>
  15. <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
  16.  
  17. <mapping resource="tomcatJndi/Car.hbm.xml"/>
  18. <mapping resource="tomcatJndi/Driver.hbm.xml"/>
  19.  
  20. </session-factory>
  21.  
  22. </hibernate-configuration>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.