diff options
author | Christian Wagner <c.wagner@datentechnik-innovation.com> | 2015-01-13 16:12:36 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2015-06-19 11:07:45 +0200 |
commit | c20d8f3da0b112864130031d39800e60289380d4 (patch) | |
tree | e378d9016f46dfe70e8ad49acabc482a04f32eec /id/server/moa-id-commons/src/main/resources | |
parent | 3ee292090346f27e7e23d4943b74ada281f20552 (diff) | |
download | moa-id-spss-c20d8f3da0b112864130031d39800e60289380d4.tar.gz moa-id-spss-c20d8f3da0b112864130031d39800e60289380d4.tar.bz2 moa-id-spss-c20d8f3da0b112864130031d39800e60289380d4.zip |
add raw configuration persistence functionality
some problems: * all tables annotated via '@Table' are created in every database connected
* loading of 'Configuration' via Spring isn't pretty at all
Diffstat (limited to 'id/server/moa-id-commons/src/main/resources')
-rw-r--r-- | id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml | 5 | ||||
-rw-r--r-- | id/server/moa-id-commons/src/main/resources/configuration.beans.xml | 53 |
2 files changed, 58 insertions, 0 deletions
diff --git a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml index e77d6c49e..640c1504c 100644 --- a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml +++ b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml @@ -7,6 +7,11 @@ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" <persistence-unit name="at.gv.egovernment.moa.id.commons.db.dao.config" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> + <class>com.datentechnik.moa.id.conf.persistence.dal.SOME_CLASS</class> + </persistence-unit> + + <persistence-unit name="moaidconf" transaction-type="RESOURCE_LOCAL"> + <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.datentechnik.moa.id.conf.persistence.dal.ConfigProperty</class> <properties> </properties> diff --git a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml new file mode 100644 index 000000000..762c55507 --- /dev/null +++ b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml @@ -0,0 +1,53 @@ +<?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:context="http://www.springframework.org/schema/context" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:aop="http://www.springframework.org/schema/aop" + 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"> + + <tx:annotation-driven /> + <context:annotation-config /> + + <context:property-placeholder location="${location}"/> + + + <bean id="configPropertyDao" + class="com.datentechnik.moa.id.conf.persistence.dal.ConfigPropertyDaoImpl" /> + <bean id="config" class="com.datentechnik.moa.id.conf.persistence.ConfigurationImpl"> + <property name="configPropertyDao" ref="configPropertyDao" /> + </bean> + + + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="true" destroy-method="close"> + <aop:scoped-proxy/> + <property name="driverClassName" value="${dataSource.driverClassName}" /> + <property name="url" value="${dataSource.url}"/> + <property name="username" value="${dataSource.username}" /> + <property name="password" value="${dataSource.password}" /> + <property name="testOnBorrow" value="true" /> + <property name="validationQuery" value="SELECT 1" /> + </bean> + + + <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> + <property name="showSql" value="true" /> + <property name="generateDdl" value="${jpaVendorAdapter.generateDdl}" /> + <property name="databasePlatform" value="${jpaVendorAdapter.databasePlatform}" /> + </bean> + + + <bean name="moaidconf" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> + <property name="dataSource" ref="dataSource" /> + <property name="jpaVendorAdapter" ref="jpaVendorAdapter" /> + <property name="persistenceUnitName" value="moaidconf" /> + </bean> + + <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + +</beans>
\ No newline at end of file |