<?xml version="1.0" encoding="UTF-8"?>

<!--
========================================================================================================================
beans-service.xml

Copyright (c) 2013 Manning Publications Co.

Willie Wheeler (willie.wheeler@gmail.com)

Book: http://manning.com/wheeler/
Blog: http://springinpractice.com/
Code: https://github.com/springinpractice
========================================================================================================================
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:c="http://www.springframework.org/schema/c"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jee="http://www.springframework.org/schema/jee"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:util="http://www.springframework.org/schema/util"
	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-3.1.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/jee
		http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
		http://www.springframework.org/schema/tx
		http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
		http://www.springframework.org/schema/util
		http://www.springframework.org/schema/util/spring-util-3.1.xsd">
	
	<jee:jndi-lookup id="dataSource" jndi-name="jdbc/Sip02DS" resource-ref="true" />
	
	<util:properties id="hibernateProperties">
		<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
		<prop key="hibernate.show_sql">false</prop>
	</util:properties>
	
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
		p:dataSource-ref="dataSource"
		p:packagesToScan="com.springinpractice.ch02.model"
		p:hibernateProperties-ref="hibernateProperties" />
	
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager"
		p:sessionFactory-ref="sessionFactory" />
	
	<tx:annotation-driven />
	
	<context:component-scan base-package="com.springinpractice.ch02.dao.hbn" />
	<context:component-scan base-package="com.springinpractice.ch02.service.impl" />
</beans>
