<?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:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

	<bean id="verifyPath" class="eu.dnetlib.enabling.is.sn.DnetPathVerifier">
		<constructor-arg value="${services.issn.path}"/>
	</bean>

	<!-- DATASOURCE -->
	<bean id="issnDataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource"
		p:driverClassName="${services.issn.hib.driverName}" p:url="${services.issn.hib.issndb.url}"
		p:username="${services.issn.hib.issndb.username}" p:password="${services.issn.hib.issndb.password}"
		depends-on="verifyPath"
		 />

	<!-- Hibernate SessionFactory -->
	<bean id="issnSessionFactory"
		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
		p:dataSource-ref="issnDataSource"
		depends-on="verifyPath"
		>
		<property name="annotatedClasses">
			<list>
				<value>eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">${services.issn.hib.issndb.dialect}</prop>
				<prop key="hibernate.show_sql">false</prop>
				<prop key="hibernate.hbm2ddl.auto">${services.issn.hibernate.hbm.auto}</prop>
			</props>
		</property>
	</bean>
	<!-- Transaction manager for a single Hibernate SessionFactory (alternative 
		to JTA) -->
	<tx:annotation-driven transaction-manager="issnTransactionManager" />

	<bean id="issnTransactionManager"
		class="org.springframework.orm.hibernate4.HibernateTransactionManager"
		p:sessionFactory-ref="issnSessionFactory" />

	<bean id="hibernateResourceStateSubscriptionDAO"
		class="eu.dnetlib.enabling.is.sn.resourcestate.hib.HibernateResourceStateSubscriptionDAOImpl"
		p:sessionFactory-ref="issnSessionFactory" />
</beans>
