Author: jeff.yuchang
Date: 2009-11-27 04:49:06 -0500 (Fri, 27 Nov 2009)
New Revision: 345
Added:
branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/src/descriptor/
branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/src/descriptor/META-INF/
branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/src/descriptor/META-INF/persistence.xml
Modified:
branches/ODE/ODE-1.x-jpa/Rakefile-riftsaw
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfDaoImpl.java
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfPropertyDaoImpl.java
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/resources/META-INF/persistence.xml
branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/build.xml
branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/pom.xml
Log:
* updated the bpel-store to use hibernate as JPA provider.
* add id for entity, otherwise hibernte will complain it, seems openjpa generate an id
automatically.
* update the @JoinColumn and HashMap to Map API, hibernate just recoginize the Map.
* add entity class in the db generation script.
Modified: branches/ODE/ODE-1.x-jpa/Rakefile-riftsaw
===================================================================
--- branches/ODE/ODE-1.x-jpa/Rakefile-riftsaw 2009-11-27 07:33:08 UTC (rev 344)
+++ branches/ODE/ODE-1.x-jpa/Rakefile-riftsaw 2009-11-27 09:49:06 UTC (rev 345)
@@ -348,12 +348,12 @@
define "bpel-store" do
compile.with projects("bpel-api", "bpel-compiler",
"bpel-dao", "bpel-obj", "bpel-schemas",
"bpel-epr",
"dao-hibernate", "dao-jpa", "utils"),
- COMMONS.logging, JAVAX.persistence, JAVAX.stream, JAVAX.transaction, HIBERNATE,
HSQLDB, XMLBEANS, XERCES, WSDL4J, OPENJPA
- compile { open_jpa_enhance }
- resources hibernate_doclet(:package=>"org.apache.ode.store.hib",
:excludedtags=>"@version,@author,@todo")
+ COMMONS.logging, JAVAX.persistence, JAVAX.stream, JAVAX.transaction, HIBERNATE,
HSQLDB, XMLBEANS, XERCES, WSDL4J
+
+ resources hibernate_doclet(:package=>"org.apache.ode.store.hib",
:excludedtags=>"@version,@author,@todo")
test.with COMMONS.collections, COMMONS.lang, JAVAX.connector, JAVAX.transaction,
DOM4J, LOG4J,
- XERCES, XALAN, JAXEN, SAXON, OPENJPA, GERONIMO.transaction
+ XERCES, XALAN, JAXEN, SAXON, GERONIMO.transaction
package :jar
end
Modified:
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfDaoImpl.java
===================================================================
---
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfDaoImpl.java 2009-11-27
07:33:08 UTC (rev 344)
+++
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfDaoImpl.java 2009-11-27
09:49:06 UTC (rev 345)
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Map;
/**
* @author Matthieu Riou <mriou at apache dot org>
@@ -38,13 +39,13 @@
public class ProcessConfDaoImpl extends JpaObj implements ProcessConfDAO {
@ManyToOne(targetEntity=DeploymentUnitDaoImpl.class,fetch=FetchType.EAGER,cascade={CascadeType.ALL})
- @Column(name="DU")
+ @JoinColumn(name="DU")
private DeploymentUnitDaoImpl _du;
@OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.ALL})
@MapKey(name="_key")
@JoinTable(name="STORE_PROC_TO_PROP")
- private HashMap<String,ProcessConfPropertyDaoImpl> _properties = new
HashMap<String,ProcessConfPropertyDaoImpl>();
+ private Map<String,ProcessConfPropertyDaoImpl> _properties = new
HashMap<String,ProcessConfPropertyDaoImpl>();
@Id @Column(name="PID")
private String _processId;
Modified:
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfPropertyDaoImpl.java
===================================================================
---
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfPropertyDaoImpl.java 2009-11-27
07:33:08 UTC (rev 344)
+++
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/ProcessConfPropertyDaoImpl.java 2009-11-27
09:49:06 UTC (rev 345)
@@ -22,6 +22,8 @@
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.Table;
/**
@@ -30,6 +32,10 @@
@Entity
@Table(name="STORE_PROCESS_PROP")
public class ProcessConfPropertyDaoImpl {
+
+ @Id @Column(name="id")
+ @GeneratedValue
+ private Long _id;
@Basic @Column(name="PROP_KEY")
private String _key;
@@ -51,4 +57,13 @@
public void setValue(String value) {
_value = value;
}
+
+ public Long getId() {
+ return _id;
+ }
+
+ public void setId(Long id) {
+ this._id = id;
+ }
+
}
Modified:
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java
===================================================================
---
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java 2009-11-27
07:33:08 UTC (rev 344)
+++
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java 2009-11-27
09:49:06 UTC (rev 345)
@@ -22,6 +22,8 @@
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.Table;
/**
@@ -30,7 +32,11 @@
@Entity
@Table(name="STORE_VERSIONS")
public class VersionTrackerDAOImpl {
-
+
+ @Id @Column(name="id")
+ @GeneratedValue
+ private Long _id;
+
@Basic @Column(name="VERSION")
private long _version;
@@ -41,4 +47,14 @@
public void setVersion(long version) {
_version = version;
}
+
+ public Long getId() {
+ return _id;
+ }
+
+ public void setId(Long id) {
+ this._id = id;
+ }
+
+
}
Modified: branches/ODE/ODE-1.x-jpa/bpel-store/src/main/resources/META-INF/persistence.xml
===================================================================
---
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/resources/META-INF/persistence.xml 2009-11-27
07:33:08 UTC (rev 344)
+++
branches/ODE/ODE-1.x-jpa/bpel-store/src/main/resources/META-INF/persistence.xml 2009-11-27
09:49:06 UTC (rev 345)
@@ -22,14 +22,19 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<persistence-unit name="ode-store">
- <!--
- This properties file is used specifically by the
- OpenJPA Enhancer.
- -->
-
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
<class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
<class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
<class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect" />
+ <property name="hibernate.connection.datasource"
value="java:BPELDB" />
+ <property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
+ <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ <property name="jta.UserTransaction"
value="jta.UserTransaction" />
+ </properties>
</persistence-unit>
</persistence>
Modified: branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/build.xml
===================================================================
--- branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/build.xml 2009-11-27 07:33:08 UTC (rev
344)
+++ branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/build.xml 2009-11-27 09:49:06 UTC (rev
345)
@@ -13,7 +13,7 @@
<property name="config.dir"
value="src/main/files/hibernate.cfg"/>
<path id="classpath">
- <path location="src/main/resources"/>
+ <path location="src/descriptor"/>
<pathelement path="${maven.runtime.classpath}"/>
</path>
Modified: branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/pom.xml
===================================================================
--- branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/pom.xml 2009-11-27 07:33:08 UTC (rev 344)
+++ branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/pom.xml 2009-11-27 09:49:06 UTC (rev 345)
@@ -78,6 +78,11 @@
<artifactId>riftsaw-utils</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.soa.bpel</groupId>
+ <artifactId>riftsaw-bpel-store</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
<!-- Database Drivers -->
<dependency>
Added: branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/src/descriptor/META-INF/persistence.xml
===================================================================
--- branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/src/descriptor/META-INF/persistence.xml
(rev 0)
+++
branches/ODE/ODE-1.x-jpa/dao-jpa-hibernate/src/descriptor/META-INF/persistence.xml 2009-11-27
09:49:06 UTC (rev 345)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~
http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.0">
+ <persistence-unit name="ode-dao">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+
+
+ <class>org.apache.ode.dao.jpa.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrSetProperty</class>
+ <class>org.apache.ode.dao.jpa.MexProperty</class>
+ <class>org.apache.ode.dao.jpa.XmlDataProperty</class>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect" />
+ <property name="hibernate.connection.datasource"
value="java:BPELDB" />
+ <property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
+ <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ <property name="jta.UserTransaction"
value="jta.UserTransaction" />
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file