[jboss-cvs] JBossAS SVN: r95098 - in projects/ejb3/trunk: build and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 19 05:08:57 EDT 2009


Author: wolfc
Date: 2009-10-19 05:08:57 -0400 (Mon, 19 Oct 2009)
New Revision: 95098

Removed:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JTATableIdGenerator.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/PersistenceUnitInfoImpl.java
Modified:
   projects/ejb3/trunk/build/pom.xml
   projects/ejb3/trunk/core/.project
   projects/ejb3/trunk/core/.settings/org.maven.ide.eclipse.prefs
   projects/ejb3/trunk/core/pom.xml
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/ExtendedEntityManager.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/InjectedSessionFactory.java
   projects/ejb3/trunk/pom.xml
Log:
EJBTHREE-1931: refactored JPA classes on jpa-int


Modified: projects/ejb3/trunk/build/pom.xml
===================================================================
--- projects/ejb3/trunk/build/pom.xml	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/build/pom.xml	2009-10-19 09:08:57 UTC (rev 95098)
@@ -519,6 +519,7 @@
       <id>default</id>
       <activation>
         <activeByDefault>true</activeByDefault>
+        <property><name>!dummy</name></property>
       </activation>
       <properties>
         <ejb3.outputDirectory>target/classes</ejb3.outputDirectory>
@@ -576,6 +577,64 @@
       </repositories>
     </profile>
 
+    <!-- JPA integration plan A: depend on the proper api artifact -->
+
+    <profile>
+      <id>JPA-1.0</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+        <property><name>!dummy</name></property>
+      </activation>
+      <properties>
+        <JPA.groupId>org.hibernate</JPA.groupId>
+        <JPA.artifactId>ejb3-persistence</JPA.artifactId>
+        <JPA.version>1.0.2.GA</JPA.version>
+        <version.org.jboss.ejb3.jboss-ejb3-jpa-int>1.0.0-SNAPSHOT</version.org.jboss.ejb3.jboss-ejb3-jpa-int>
+        <version.org.hibernate>3.3.1.GA</version.org.hibernate>
+        <version.org.hibernate.hibernate-entitymanager>3.3.2.GA</version.org.hibernate.hibernate-entitymanager>
+      </properties>
+    </profile>
+
+    <profile>
+      <id>JPA-2.0</id>
+      <activation>
+        <activeByDefault>false</activeByDefault>
+        <!-- either mvn -PJPA-2.0,default or -DJPA-2.0 -->
+        <property><name>JPA-2.0</name></property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-enforcer-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>obsoletes-org.hibernate:ejb3-persistence</id>
+                <goals>
+                  <goal>enforce</goal>
+                </goals>
+                <configuration>
+                  <rules>
+                    <bannedDependencies>
+                      <excludes>
+                        <exclude>org.hibernate:ejb3-persistence</exclude>
+                      </excludes>
+                    </bannedDependencies>
+                  </rules>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+      <properties>
+        <JPA.groupId>org.hibernate.persistence</JPA.groupId>
+        <JPA.artifactId>jpa-api</JPA.artifactId>
+        <JPA.version>2.0.Beta-20090815</JPA.version>
+        <version.org.jboss.ejb3.jboss-ejb3-jpa-int>2.0.0-SNAPSHOT</version.org.jboss.ejb3.jboss-ejb3-jpa-int>
+        <version.org.hibernate>3.5.0.Beta-1</version.org.hibernate>
+        <version.org.hibernate.hibernate-entitymanager>3.5.0.Beta-1</version.org.hibernate.hibernate-entitymanager>
+      </properties>
+    </profile>
   </profiles>
 
 </project>

Modified: projects/ejb3/trunk/core/.project
===================================================================
--- projects/ejb3/trunk/core/.project	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/.project	2009-10-19 09:08:57 UTC (rev 95098)
@@ -6,9 +6,11 @@
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>
     </buildCommand>
+    <!-- 
     <buildCommand>
       <name>org.maven.ide.eclipse.maven2Builder</name>
     </buildCommand>
+    -->
   </buildSpec>
   <natures>
     <nature>org.eclipse.jdt.core.javanature</nature>

Modified: projects/ejb3/trunk/core/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/ejb3/trunk/core/.settings/org.maven.ide.eclipse.prefs	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/.settings/org.maven.ide.eclipse.prefs	2009-10-19 09:08:57 UTC (rev 95098)
@@ -1,8 +1,9 @@
-#Wed Mar 11 16:18:11 CET 2009
-activeProfiles=eclipse
+#Fri Oct 02 12:42:17 CEST 2009
+activeProfiles=eclipse,JPA-2.0
 eclipse.preferences.version=1
-fullBuildGoals=
+fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=false
-resourceFilterGoals=
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
 version=1

Modified: projects/ejb3/trunk/core/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/pom.xml	2009-10-19 09:08:57 UTC (rev 95098)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.jboss.ejb3</groupId>
     <artifactId>jboss-ejb3-build</artifactId>
-    <version>1.0.4</version>
+    <version>1.0.5-SNAPSHOT</version>
     <relativePath>../build/pom.xml</relativePath>
   </parent>
 
@@ -156,13 +156,13 @@
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-core</artifactId>
-      <version>3.3.1.GA</version>
+      <version>${version.org.hibernate}</version>
     </dependency>
 
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-annotations</artifactId>
-      <version>3.3.1.GA</version>
+      <version>${version.org.hibernate}</version>
       <!-- Exclude org.hibernate:hibernate which is banned in
       favour of org.hibernate:hibernate-core -->
       <exclusions>
@@ -176,7 +176,7 @@
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-entitymanager</artifactId>
-      <version>3.3.2.GA</version>
+      <version>${version.org.hibernate.hibernate-entitymanager}</version>
       <!-- Exclude org.hibernate:hibernate which is banned in
       favour of org.hibernate:hibernate-core -->
       <exclusions>
@@ -203,7 +203,12 @@
       <groupId>org.jboss.metadata</groupId>
       <artifactId>jboss-metadata</artifactId>
       <exclusions>
+        <!-- jboss-metadata must not dictate the JPA API -->
         <exclusion>
+          <groupId>org.hibernate</groupId>
+          <artifactId>ejb3-persistence</artifactId>
+        </exclusion>
+        <exclusion>
           <groupId>jboss.jbossws</groupId>
           <artifactId>jboss-jaxws</artifactId>
         </exclusion>
@@ -380,6 +385,12 @@
 
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-jpa-int</artifactId>
+      <version>${version.org.jboss.ejb3.jboss-ejb3-jpa-int}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-security</artifactId>
       <version>1.0.0</version>
     </dependency>
@@ -582,7 +593,12 @@
           <groupId>jboss</groupId>
           <artifactId>jboss-remoting</artifactId>
         </exclusion>
+        <!-- jboss-as-server must not dictate the JPA API -->
         <exclusion>
+          <groupId>org.hibernate</groupId>
+          <artifactId>ejb3-persistence</artifactId>
+        </exclusion>
+        <exclusion>
           <groupId>org.jboss</groupId>
           <artifactId>jboss-metadata</artifactId>
         </exclusion>

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/ExtendedEntityManager.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/ExtendedEntityManager.java	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/ExtendedEntityManager.java	2009-10-19 09:08:57 UTC (rev 95098)
@@ -22,12 +22,12 @@
 package org.jboss.ejb3.entity;
 
 import java.io.Serializable;
+
 import javax.persistence.EntityManager;
-import javax.persistence.EntityTransaction;
-import javax.persistence.FlushModeType;
-import javax.persistence.LockModeType;
+
 import org.hibernate.Session;
 import org.hibernate.ejb.HibernateEntityManager;
+import org.jboss.ejb3.jpa.integration.AbstractEntityManagerDelegator;
 import org.jboss.ejb3.stateful.StatefulBeanContext;
 
 /**
@@ -35,7 +35,7 @@
  *
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  */
-public class ExtendedEntityManager implements EntityManager, HibernateSession, Serializable, ExtendedPersistenceContext
+public class ExtendedEntityManager extends AbstractEntityManagerDelegator implements EntityManager, HibernateSession, Serializable, ExtendedPersistenceContext
 {
    private static final long serialVersionUID = -2221892311301499591L;
    
@@ -50,18 +50,17 @@
    {
    }
 
-   public EntityManager getPersistenceContext()
+   public void close()
    {
-      StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
-      EntityManager persistenceContext = beanContext.getExtendedPersistenceContext(identity);
-      if (persistenceContext == null)
-         throw new RuntimeException("Unable to determine persistenceContext: " + identity
-                                    + " in injected SFSB: " + beanContext.getContainer().getObjectName());
-      return persistenceContext;
+      throw new IllegalStateException("It is illegal to close an injected EntityManager");
    }
 
-   // delegates
-
+   @Override
+   protected EntityManager getEntityManager()
+   {
+      return getPersistenceContext();
+   }
+   
    public Session getHibernateSession()
    {
       if (getPersistenceContext() instanceof HibernateEntityManager)
@@ -70,116 +69,15 @@
       }
       throw new RuntimeException("ILLEGAL ACTION:  Not a Hibernate persistence provider");
    }
-
-   public void joinTransaction()
+   
+   public EntityManager getPersistenceContext()
    {
-      getPersistenceContext().joinTransaction();
+      StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
+      EntityManager persistenceContext = beanContext.getExtendedPersistenceContext(identity);
+      if (persistenceContext == null)
+         throw new RuntimeException("Unable to determine persistenceContext: " + identity
+                                    + " in injected SFSB: " + beanContext.getContainer().getObjectName());
+      return persistenceContext;
    }
-
-   public void clear()
-   {
-      getPersistenceContext().clear();
-   }
-
-   public void lock(Object entity, LockModeType lockMode)
-   {
-      getPersistenceContext().lock(entity, lockMode);
-   }
-
-   public FlushModeType getFlushMode()
-   {
-      return getPersistenceContext().getFlushMode();
-   }
-
-   public <T> T getReference(Class<T> entityClass, Object primaryKey)
-   {
-      return getPersistenceContext().getReference(entityClass, primaryKey);
-   }
-
-   public void persist(Object entity)
-   {
-      getPersistenceContext().persist(entity);
-   }
-
-   public <T> T merge(T entity)
-   {
-      return getPersistenceContext().merge(entity);
-   }
-
-   public void remove(Object entity)
-   {
-      getPersistenceContext().remove(entity);
-   }
-
-   public <T> T find(Class<T> entityClass, Object primaryKey)
-   {
-      return getPersistenceContext().find(entityClass, primaryKey);
-   }
-
-   public void flush()
-   {
-      getPersistenceContext().flush();
-   }
-
-   public javax.persistence.Query createQuery(String ejbqlString)
-   {
-      return getPersistenceContext().createQuery(ejbqlString);
-   }
-
-   public javax.persistence.Query createNamedQuery(String name)
-   {
-      return getPersistenceContext().createNamedQuery(name);
-   }
-
-   public javax.persistence.Query createNativeQuery(String sqlString)
-   {
-      return getPersistenceContext().createNativeQuery(sqlString);
-   }
-
-   public javax.persistence.Query createNativeQuery(String sqlString, Class resultClass)
-   {
-      return getPersistenceContext().createNativeQuery(sqlString, resultClass);
-   }
-
-   public javax.persistence.Query createNativeQuery(String sqlString, String resultSetMapping)
-   {
-      return getPersistenceContext().createNativeQuery(sqlString, resultSetMapping);
-   }
-
-   public void refresh(Object entity)
-   {
-      getPersistenceContext().refresh(entity);
-   }
-
-   public boolean contains(Object entity)
-   {
-      return getPersistenceContext().contains(entity);
-   }
-
-   public void close()
-   {
-      throw new IllegalStateException("It is illegal to close an injected EntityManager");
-   }
-
-   public boolean isOpen()
-   {
-      return getPersistenceContext().isOpen();
-   }
-
-   public EntityTransaction getTransaction()
-   {
-      return getPersistenceContext().getTransaction();
-   }
-
-   public void setFlushMode(FlushModeType flushMode)
-   {
-      getPersistenceContext().setFlushMode(flushMode);
-   }
-
-   public Object getDelegate()
-   {
-      return getPersistenceContext().getDelegate();
-   }
-
 }
 

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/InjectedSessionFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/InjectedSessionFactory.java	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/InjectedSessionFactory.java	2009-10-19 09:08:57 UTC (rev 95098)
@@ -25,25 +25,13 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.io.Serializable;
-import java.sql.Connection;
-import java.util.Map;
-import java.util.Set;
 
-import javax.naming.NamingException;
-import javax.naming.Reference;
 import javax.persistence.EntityManagerFactory;
 
 import org.hibernate.HibernateException;
-import org.hibernate.Interceptor;
 import org.hibernate.SessionFactory;
-import org.hibernate.StatelessSession;
-import org.hibernate.classic.Session;
 import org.hibernate.ejb.HibernateEntityManagerFactory;
-import org.hibernate.engine.FilterDefinition;
-import org.hibernate.metadata.ClassMetadata;
-import org.hibernate.metadata.CollectionMetadata;
-import org.hibernate.stat.Statistics;
+import org.jboss.ejb3.jpa.integration.AbstractSessionFactoryDelegator;
 import org.jboss.jpa.deployment.ManagedEntityManagerFactory;
 import org.jboss.jpa.util.ManagedEntityManagerFactoryHelper;
 
@@ -53,7 +41,7 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public class InjectedSessionFactory implements SessionFactory, Externalizable
+public class InjectedSessionFactory extends AbstractSessionFactoryDelegator implements SessionFactory, Externalizable
 {
    private static final long serialVersionUID = 7866450655332120010L;
    
@@ -86,157 +74,13 @@
       return delegate;
    }
 
-   private SessionFactory getSessionFactory()
+   protected SessionFactory getSessionFactory()
    {
       return ((HibernateEntityManagerFactory)getDelegate()).getSessionFactory();
    }
 
-   public Set getDefinedFilterNames()
+   public void close() throws HibernateException
    {
-      return getSessionFactory().getDefinedFilterNames();
-   }
-
-   public FilterDefinition getFilterDefinition(String filterName) throws HibernateException
-   {
-      return getSessionFactory().getFilterDefinition(filterName);
-   }
-
-   public Session openSession(Connection connection)
-   {
-      return getSessionFactory().openSession(connection);
-   }
-
-   public Session openSession(Interceptor interceptor)
-   throws HibernateException
-   {
-      return getSessionFactory().openSession(interceptor);
-   }
-
-   public Session openSession(Connection connection, Interceptor interceptor)
-   {
-      return getSessionFactory().openSession(connection, interceptor);
-   }
-
-   public Session openSession()
-   throws HibernateException
-   {
-      return getSessionFactory().openSession();
-   }
-
-   public Session getCurrentSession()
-   throws HibernateException
-   {
-      return getSessionFactory().getCurrentSession();
-   }
-
-   public ClassMetadata getClassMetadata(Class persistentClass)
-   throws HibernateException
-   {
-      return getSessionFactory().getClassMetadata(persistentClass);
-   }
-
-   public ClassMetadata getClassMetadata(String entityName)
-   throws HibernateException
-   {
-      return getSessionFactory().getClassMetadata(entityName);
-   }
-
-   public CollectionMetadata getCollectionMetadata(String roleName)
-   throws HibernateException
-   {
-      return getSessionFactory().getCollectionMetadata(roleName);
-   }
-
-   public Map getAllClassMetadata()
-   throws HibernateException
-   {
-      return getSessionFactory().getAllClassMetadata();
-   }
-
-   public Map getAllCollectionMetadata()
-   throws HibernateException
-   {
-      return getSessionFactory().getAllCollectionMetadata();
-   }
-
-   public Statistics getStatistics()
-   {
-      return getSessionFactory().getStatistics();
-   }
-
-   public void close()
-   throws HibernateException
-   {
       throw new IllegalStateException("It is illegal to close an injected SessionFactory");
    }
-
-   public boolean isClosed()
-   {
-      return getSessionFactory().isClosed();
-   }
-
-   public void evict(Class persistentClass)
-   throws HibernateException
-   {
-      getSessionFactory().evict(persistentClass);
-   }
-
-   public void evict(Class persistentClass, Serializable id)
-   throws HibernateException
-   {
-      getSessionFactory().evict(persistentClass, id);
-   }
-
-   public void evictEntity(String entityName)
-   throws HibernateException
-   {
-      getSessionFactory().evictEntity(entityName);
-   }
-
-   public void evictEntity(String entityName, Serializable id)
-   throws HibernateException
-   {
-      getSessionFactory().evictEntity(entityName, id);
-   }
-
-   public void evictCollection(String roleName)
-   throws HibernateException
-   {
-      getSessionFactory().evictCollection(roleName);
-   }
-
-   public void evictCollection(String roleName, Serializable id)
-   throws HibernateException
-   {
-      getSessionFactory().evictCollection(roleName, id);
-   }
-
-   public void evictQueries()
-   throws HibernateException
-   {
-      getSessionFactory().evictQueries();
-   }
-
-   public void evictQueries(String cacheRegion)
-   throws HibernateException
-   {
-      getSessionFactory().evictQueries(cacheRegion);
-   }
-
-   public StatelessSession openStatelessSession()
-   {
-      return getSessionFactory().openStatelessSession();
-   }
-
-   public StatelessSession openStatelessSession(Connection connection)
-   {
-      return getSessionFactory().openStatelessSession(connection);
-   }
-
-   public Reference getReference()
-   throws NamingException
-   {
-      return getSessionFactory().getReference();
-   }
-
 }

Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JTATableIdGenerator.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JTATableIdGenerator.java	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/JTATableIdGenerator.java	2009-10-19 09:08:57 UTC (rev 95098)
@@ -1,353 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.entity;
-
-import java.io.Serializable;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Properties;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.HibernateException;
-import org.hibernate.LockMode;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.engine.SessionImplementor;
-import org.hibernate.exception.JDBCExceptionHelper;
-import org.hibernate.id.Configurable;
-import org.hibernate.id.IdentifierGenerationException;
-import org.hibernate.id.IdentifierGeneratorFactory;
-import org.hibernate.id.PersistentIdentifierGenerator;
-import org.hibernate.transaction.JBossTransactionManagerLookup;
-import org.hibernate.transaction.TransactionManagerLookup;
-import org.hibernate.type.Type;
-import org.hibernate.util.PropertiesHelper;
-
-/**
- * A hilo <tt>IdentifierGenerator</tt> that uses a database
- * table to store the last generated value.
- * <p/>
- * <p/>
- * This implementation is solely for use inside JBoss using JTA for transactions.
- * </p>
- * <p/>
- * TODO implement sequence allocation
- *
- * @author <a href="mailto:kr at hbt.de">Klaus Richarz</a>.
- * @version <tt>$Revision$</tt>
- * @see org.hibernate.id.TableGenerator
- * @see javax.persistence.TableGenerator
- */
-public class JTATableIdGenerator implements PersistentIdentifierGenerator, Configurable
-{
-   /* COLUMN and TABLE should be renamed but it would break the public API */
-   /**
-    * The column parameter
-    */
-   public static final String COLUMN = "column";
-
-   /**
-    * Default column name
-    */
-   public static final String DEFAULT_COLUMN_NAME = "next_hi";
-
-   /**
-    * The table parameter
-    */
-   public static final String TABLE = "table";
-
-   /**
-    * Default table name
-    */
-   public static final String DEFAULT_TABLE_NAME = "next_hi";
-
-   /**
-    * The allocation-size parameter
-    */
-   public static final String ALLOCATION_SIZE = "allocationSize";
-
-   /**
-    * Default allocation-size
-    */
-   public static final int DEFAULT_ALLOCATION_SIZE = 20;
-
-   /**
-    * logger for JTATableGenerator
-    */
-   private static final Log log = LogFactory.getLog(JTATableIdGenerator.class);
-
-   /**
-    * Holds the name where this generator gets its sequence from
-    */
-   private String tableName;
-
-   /**
-    * Holds the name ofthe column where the next sequence value is stored
-    */
-   private String columnName;
-
-   /**
-    * Holds the sql query to retrieve the next high value
-    */
-   private String query;
-
-   /**
-    * Holds the sql query to increment the sequence
-    */
-   private String update;
-
-   /**
-    * Holds the transaction manager lookup object
-    */
-   private TransactionManagerLookup transactionManagerLookup;
-
-   /**
-    * Holds the class type for the sequence value returned by generate()
-    */
-   private Class returnClass;
-
-   /**
-    * Holds the size for the sequence increment. The allocated sequences are managed in memory
-    * and may be lost if the system stops.
-    */
-   private int allocationSize;
-
-   public void configure(Type type, Properties params, Dialect dialect)
-   {
-      this.tableName = PropertiesHelper.getString(TABLE, params, DEFAULT_TABLE_NAME);
-      this.columnName = PropertiesHelper.getString(COLUMN, params, DEFAULT_COLUMN_NAME);
-      this.allocationSize = PropertiesHelper.getInt(ALLOCATION_SIZE, params, DEFAULT_ALLOCATION_SIZE);
-      String schemaName = params.getProperty(SCHEMA);
-      String catalogName = params.getProperty(CATALOG);
-
-      if (true) throw new RuntimeException("DOES ANYBODY USE THIS?  It IS CURRENTLY BROKEN");
-
-      /*
-      getSchemaSeparator does not exist in hibernate anymore since 3.1 release
-
-      // prepare table name
-      if (tableName.indexOf(dialect.getSchemaSeparator()) < 0)
-      {
-         tableName = Table.qualify(catalogName, schemaName, tableName, dialect.getSchemaSeparator());
-      }
-      */
-
-      // prepare SQL statements
-      query = "select " +
-              columnName +
-              " from " +
-              dialect.appendLockHint(LockMode.UPGRADE, tableName) +
-              dialect.getForUpdateString();
-      update = "update " +
-               tableName +
-               " set " +
-               columnName +
-               " = ? where " +
-               columnName +
-               " = ?";
-
-      // set up transaction manager lookup
-      // only JBoss transaction manager is supported
-      transactionManagerLookup = new JBossTransactionManagerLookup();
-
-      // set the sequence type that should be returned
-      returnClass = type.getReturnedClass();
-
-      // debug chosen configuration
-      if (log.isDebugEnabled())
-      {
-         log.debug("configuring id generator: " + this.getClass().getName());
-         log.debug("tableName=" + tableName);
-         log.debug("columnName=" + columnName);
-         log.debug("allocationSize=" + allocationSize);
-         log.debug("query=" + query);
-         log.debug("update=" + update);
-         log.debug("returnClass=" + returnClass);
-      }
-   }
-
-   public synchronized Serializable generate(SessionImplementor session, Object object)
-           throws HibernateException
-   {
-      // get TransactionManager from JNDI
-      // no JNDI properties provided -> we are in the container
-      TransactionManager tm = transactionManagerLookup.getTransactionManager(new Properties());
-      Transaction surroundingTransaction = null;  // for resuming in finally block
-      Connection conn = null; // for ressource cleanup
-      String sql = null; // for exception
-      try
-      {
-         long result; // holds the resulting sequence value
-
-         // prepare a new transaction context for the generator
-         surroundingTransaction = tm.suspend();
-         if (log.isDebugEnabled())
-         {
-            log.debug("surrounding tx suspended");
-         }
-         tm.begin();
-
-         // get connection from managed environment
-         conn = session.getBatcher().openConnection();
-
-         // execute fetching of current sequence value
-         sql = query;
-         PreparedStatement qps = conn.prepareStatement(query);
-         try
-         {
-            ResultSet rs = qps.executeQuery();
-            if (!rs.next())
-            {
-               String err = "could not read sequence value - you need to populate the table: " + tableName;
-               log.error(err);
-               throw new IdentifierGenerationException(err);
-            }
-            result = rs.getLong(1);
-            rs.close();
-         }
-         catch (SQLException sqle)
-         {
-            log.error("could not read a sequence value", sqle);
-            throw sqle;
-         }
-         finally
-         {
-            qps.close();
-         }
-
-         // increment sequence value
-         sql = update;
-         long sequence = result + 1;
-         PreparedStatement ups = conn.prepareStatement(update);
-         try
-         {
-            ups.setLong(1, sequence);
-            ups.setLong(2, result);
-            ups.executeUpdate();
-         }
-         catch (SQLException sqle)
-         {
-            log.error("could not update sequence value in: " + tableName, sqle);
-            throw sqle;
-         }
-         finally
-         {
-            ups.close();
-         }
-
-         // commit transaction to ensure updated sequence is not rolled back
-         tm.commit();
-
-         // transform sequence to the desired type and return the value
-         Number typedSequence = IdentifierGeneratorFactory.createNumber(sequence, returnClass);
-         if (log.isDebugEnabled())
-         {
-            log.debug("generate() returned: " + typedSequence);
-         }
-         return typedSequence;
-      }
-      catch (SQLException sqle)
-      {
-         throw JDBCExceptionHelper.convert(session.getFactory().getSQLExceptionConverter(),
-                                           sqle,
-                                           "could not get or update next value",
-                                           sql);
-      }
-      catch (Exception e)
-      {
-         try
-         {
-            tm.rollback();
-            throw new HibernateException(e);
-         }
-         catch (SystemException e1)
-         {
-            throw new HibernateException(e1);
-         }
-      }
-      finally
-      {
-         if (conn != null)
-            try
-            {
-               conn.close();
-            }
-            catch (SQLException e)
-            {
-               // ignore exception
-            }
-         // switch back to surrounding transaction context
-         if (surroundingTransaction != null)
-         {
-            try
-            {
-               tm.resume(surroundingTransaction);
-               if (log.isDebugEnabled())
-               {
-                  log.debug("surrounding tx resumed");
-               }
-            }
-            catch (Exception e)
-            {
-               throw new HibernateException(e);
-            }
-         }
-      }
-   }
-
-
-   public String[] sqlCreateStrings(Dialect dialect) throws HibernateException
-   {
-      return new String[]{
-         "create table " + tableName + " ( " + columnName + " " + dialect.getTypeName(Types.BIGINT) + " )",
-         "insert into " + tableName + " values ( 0 )"
-      };
-   }
-
-   public String[] sqlDropStrings(Dialect dialect)
-   {
-      //return "drop table " + tableName + dialect.getCascadeConstraintsString();
-      StringBuffer sqlDropString = new StringBuffer()
-              .append("drop table ");
-      if (dialect.supportsIfExistsBeforeTableName())
-      {
-         sqlDropString.append("if exists ");
-      }
-      sqlDropString.append(tableName)
-              .append(dialect.getCascadeConstraintsString());
-      if (dialect.supportsIfExistsAfterTableName())
-      {
-         sqlDropString.append(" if exists");
-      }
-      return new String[]{sqlDropString.toString()};
-   }
-
-   public Object generatorKey()
-   {
-      return tableName;
-   }
-}

Deleted: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/PersistenceUnitInfoImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/PersistenceUnitInfoImpl.java	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/PersistenceUnitInfoImpl.java	2009-10-19 09:08:57 UTC (rev 95098)
@@ -1,187 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.entity;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import javax.persistence.spi.PersistenceUnitInfo;
-import javax.persistence.spi.PersistenceUnitTransactionType;
-import javax.persistence.spi.ClassTransformer;
-import javax.sql.DataSource;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class PersistenceUnitInfoImpl implements PersistenceUnitInfo
-{
-   private String entityManagerName;
-   private DataSource jtaDataSource;
-   private DataSource nonJtaDataSource;
-   private List<String> mappingFileNames;
-   private List<URL> jarFiles;
-   private List<String> entityclassNames;
-   private Properties properties;
-   private ClassLoader classLoader;
-   private String persistenceProviderClassName;
-   private PersistenceUnitTransactionType transactionType;
-   private URL persistenceUnitRootUrl;
-   private boolean excludeClasses;
-
-   public PersistenceUnitInfoImpl()
-   {
-   }
-
-   public void addTransformer(ClassTransformer transformer)
-   {
-      //throw new RuntimeException("NOT IMPLEMENTED");
-   }
-
-   public ClassLoader getNewTempClassLoader()
-   {
-      return null;
-   }
-
-   public String getPersistenceProviderClassName()
-   {
-      return persistenceProviderClassName;
-   }
-
-   public void setPersistenceProviderClassName(String persistenceProviderClassName)
-   {
-      this.persistenceProviderClassName = persistenceProviderClassName;
-   }
-
-   public String getPersistenceUnitName()
-   {
-      return entityManagerName;
-   }
-
-   public void setPersistenceUnitName(String entityManagerName)
-   {
-      this.entityManagerName = entityManagerName;
-   }
-
-   public DataSource getJtaDataSource()
-   {
-      return jtaDataSource;
-   }
-
-   public void setJtaDataSource(DataSource jtaDataSource)
-   {
-      this.jtaDataSource = jtaDataSource;
-   }
-
-   public DataSource getNonJtaDataSource()
-   {
-      return nonJtaDataSource;
-   }
-
-   public void setNonJtaDataSource(DataSource nonJtaDataSource)
-   {
-      this.nonJtaDataSource = nonJtaDataSource;
-   }
-
-   public List<String> getMappingFileNames()
-   {
-      return mappingFileNames;
-   }
-
-   public void setMappingFileNames(List<String> mappingFileNames)
-   {
-      this.mappingFileNames = mappingFileNames;
-   }
-
-   public List<URL> getJarFileUrls()
-   {
-      return jarFiles;
-   }
-
-   public void setJarFiles(List<URL> jarFiles)
-   {
-      this.jarFiles = jarFiles;
-   }
-
-   public List<String> getManagedClassNames()
-   {
-      return entityclassNames;
-   }
-
-   public void setManagedClassnames(List<String> entityclassNames)
-   {
-      this.entityclassNames = entityclassNames;
-   }
-
-   public Properties getProperties()
-   {
-      return properties;
-   }
-
-   public void setProperties(Properties properties)
-   {
-      this.properties = properties;
-   }
-
-   public ClassLoader getClassLoader()
-   {
-      return classLoader;
-   }
-
-   public void setClassLoader(ClassLoader classLoader)
-   {
-      this.classLoader = classLoader;
-   }
-
-   public PersistenceUnitTransactionType getTransactionType()
-   {
-      return transactionType;
-   }
-
-   public void setTransactionType(PersistenceUnitTransactionType transactionType)
-   {
-      this.transactionType = transactionType;
-   }
-
-   public URL getPersistenceUnitRootUrl()
-   {
-      return persistenceUnitRootUrl;
-   }
-
-   public void setPersistenceUnitRootUrl(URL persistenceUnitRootUrl)
-   {
-      this.persistenceUnitRootUrl = persistenceUnitRootUrl;
-   }
-
-   public boolean excludeUnlistedClasses()
-   {
-      return excludeClasses;
-   }
-
-   public void setExcludeUnlistedClasses(boolean excludeClasses)
-   {
-      this.excludeClasses = excludeClasses;
-   }
-
-}

Modified: projects/ejb3/trunk/pom.xml
===================================================================
--- projects/ejb3/trunk/pom.xml	2009-10-19 09:04:35 UTC (rev 95097)
+++ projects/ejb3/trunk/pom.xml	2009-10-19 09:08:57 UTC (rev 95098)
@@ -53,6 +53,7 @@
     <module>injection</module>
     <module>installer</module>
     <module>interceptors</module>
+    <module>jpa-int</module>
     <!-- <module>locator</module> -->
     <module>metadata</module>
     <module>metrics-deployer</module>




More information about the jboss-cvs-commits mailing list