Skip to content

Instantly share code, notes, and snippets.

View IanDarwin's full-sized avatar

Ian Darwin IanDarwin

View GitHub Profile
@IanDarwin
IanDarwin / applicationContext.xml
Created February 3, 2017 17:59
Spring ApplicationContext that includes Hibernate config, saving one file
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:javaee="http://www.springframework.org/schema/jee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
<javaee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/lhbooks"/>
<!-- This obviates the need for a hibernate.cfg.xml -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>entity/entity.hbm.xml</value>
<value>orderproc/orderproc.hbm.xml</value>
</list>