<?xml version="1.0" encoding="UTF-8"?>
<beans profile="advancedLogOn"
    xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

	<context:annotation-config></context:annotation-config>
	<tx:annotation-driven transaction-manager="statisticLogTransactionManager"/>
				
    <bean id="statisticLogDataSource" class="org.apache.commons.dbcp2.BasicDataSource" lazy-init="true" destroy-method="close">
		<aop:scoped-proxy/>
		<property name="driverClassName" value="${advancedlogging.hibernate.connection.driver_class}" />
		<property name="url" value="${advancedlogging.hibernate.connection.url}"/>
		<property name="username" value="${advancedlogging.hibernate.connection.username}" />
		<property name="password" value="${advancedlogging.hibernate.connection.password}" />
				
		<property name="connectionProperties" value="${advancedlogging.dbcp.connectionProperties}" />
		<property name="initialSize" value="${advancedlogging.dbcp.initialSize}" />		
		<property name="maxTotal" value="${advancedlogging.dbcp.maxActive}" />
		<property name="maxIdle" value="${advancedlogging.dbcp.maxIdle}" />
		<property name="minIdle" value="${advancedlogging.dbcp.minIdle}" />
		<!-- property name="maxWait" value="${moasession.dbcp.maxWaitMillis}" / -->
		<property name="testOnBorrow" value="${advancedlogging.dbcp.testOnBorrow}" />
		<property name="testOnReturn" value="${advancedlogging.dbcp.testOnReturn}" />
		<property name="testWhileIdle" value="${advancedlogging.dbcp.testWhileIdle}" />
		<property name="validationQuery" value="${advancedlogging.dbcp.validationQuery}" />
	</bean>
	
<!-- 	<bean id="statisticLogSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
    	<property name="dataSource"  ref="statisticLogDataSource"/>
    	<property name="packagesToScan" value="at.gv.egovernment.moa.id.commons.db.dao.statistic" />
    	<property name="hibernateProperties">
    	
        	<props>
            	<prop key="hibernate.dialect">${advancedlogging.hibernate.dialect}</prop>
            	<prop key="hibernate.show_sql">${advancedlogging.hibernate.show_sql}</prop>
            	<prop key="hibernate.hbm2ddl.auto">${advancedlogging.hibernate.hbm2ddl.auto}</prop>
            	<prop key="current_session_context_class">${advancedlogging.hibernate.current_session_context_class}</prop>
            	<prop key="hibernate.transaction.flush_before_completion">${advancedlogging.hibernate.transaction.flush_before_completion}</prop>
                <prop key="hibernate.transaction.auto_close_session">${advancedlogging.hibernate.transaction.auto_close_session}</prop>
        	</props>
    	</property>
	</bean> -->
 

    <!-- bean id="statisticLogDBUtils" class="at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils"/-->
    
    <bean name="statisticLogTransactionManager" id="statisticLogTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="statistic" />
	</bean> 
	
	<bean id="statisticJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
		<property name="showSql" value="${advancedlogging.hibernate.show_sql}" />
		<property name="generateDdl" value="${advancedlogging.jpaVendorAdapter.generateDdl}" />
		<property name="databasePlatform" value="${advancedlogging.hibernate.dialect}" />
	</bean>
	
	<bean name="statistic" id="statistic" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="statisticLogDataSource" />
		<property name="jpaVendorAdapter" ref="statisticJpaVendorAdapter" />
		<property name="packagesToScan" value="at.gv.egovernment.moa.id.commons.db.dao.statistic" />
		<property name="persistenceUnitName" value="statistic" />
	</bean> 
	

	
</beans>