Skip to content

Instantly share code, notes, and snippets.

@odrotbohm
Forked from emmanuelbernard/Spring persistence.xml
Created January 14, 2011 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odrotbohm/779630 to your computer and use it in GitHub Desktop.
Save odrotbohm/779630 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:j2ee="http://www.springframework.org/schema/j2ee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/j2ee http://www.springframework.org/schema/j2ee/spring-j2ee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="datasource" />
<property name="packagesToScan" value="com.mycomany.hbparentid" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- Local DataSource & transactions -->
<jdbc:embedded-database id="datasource" type="HSQL" />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:annotation-driven/>
<!-- or JTA usage -->
<j2ee:jndi-lookup id="datasource" jndi-name="java/DefaultDS" />
<tx:jta-transaction-manager />
<tx:annotation-driven />
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment