[jboss-cvs] JBossAS SVN: r94268 - in projects/ejb3/trunk: jpa-int and 12 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 2 08:48:56 EDT 2009
Author: wolfc
Date: 2009-10-02 08:48:55 -0400 (Fri, 02 Oct 2009)
New Revision: 94268
Added:
projects/ejb3/trunk/jpa-int/
projects/ejb3/trunk/jpa-int/.classpath
projects/ejb3/trunk/jpa-int/.project
projects/ejb3/trunk/jpa-int/.settings/
projects/ejb3/trunk/jpa-int/.settings/org.eclipse.jdt.core.prefs
projects/ejb3/trunk/jpa-int/.settings/org.maven.ide.eclipse.prefs
projects/ejb3/trunk/jpa-int/pom.xml
projects/ejb3/trunk/jpa-int/src/
projects/ejb3/trunk/jpa-int/src/main/
projects/ejb3/trunk/jpa-int/src/main/java/
projects/ejb3/trunk/jpa-int/src/main/java/org/
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractEntityManagerDelegator.java
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractSessionFactoryDelegator.java
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_3SessionFactoryDelegator.java
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_5SessionFactoryDelegator.java
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA1EntityManagerDelegator.java
projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA2EntityManagerDelegator.java
projects/ejb3/trunk/jpa-int/src/test/
projects/ejb3/trunk/jpa-int/src/test/java/
projects/ejb3/trunk/jpa-int/src/test/java/hack/
projects/ejb3/trunk/jpa-int/src/test/java/hack/Dummy.java
Log:
EJBTHREE-1931: created jpa-int module
Property changes on: projects/ejb3/trunk/jpa-int
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
Added: projects/ejb3/trunk/jpa-int/.classpath
===================================================================
--- projects/ejb3/trunk/jpa-int/.classpath (rev 0)
+++ projects/ejb3/trunk/jpa-int/.classpath 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="eclipse-target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="eclipse-target/tests-classes" path="src/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/ejb3/trunk/jpa-int/.project
===================================================================
--- projects/ejb3/trunk/jpa-int/.project (rev 0)
+++ projects/ejb3/trunk/jpa-int/.project 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,19 @@
+<projectDescription>
+ <name>jboss-ejb3-jpa-int</name>
+ <comment>JBoss EJB 3.x JPA Integration</comment>
+ <projects/>
+ <buildSpec>
+ <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>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/ejb3/trunk/jpa-int/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/jpa-int/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/ejb3/trunk/jpa-int/.settings/org.eclipse.jdt.core.prefs 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,5 @@
+#Fri Oct 02 10:46:03 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/ejb3/trunk/jpa-int/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/ejb3/trunk/jpa-int/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/ejb3/trunk/jpa-int/.settings/org.maven.ide.eclipse.prefs 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,9 @@
+#Fri Oct 02 14:45:27 CEST 2009
+activeProfiles=eclipse,JPA-2.0
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/ejb3/trunk/jpa-int/pom.xml
===================================================================
--- projects/ejb3/trunk/jpa-int/pom.xml (rev 0)
+++ projects/ejb3/trunk/jpa-int/pom.xml 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,56 @@
+<!--
+ vi:ts=2:sw=2:expandtab
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-build</artifactId>
+ <version>1.0.4</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Configuration -->
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-jpa-int</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <name>JBoss EJB 3.x JPA Integration</name>
+ <description>JBoss EJB 3.x JPA Integration</description>
+ <url>http://www.jboss.org/jbossejb3</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.5.0.Beta-1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate.java-persistence</groupId>
+ <artifactId>jpa-api</artifactId>
+ <version>2.0.Beta-20090815</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ -->
+ </dependencies>
+</project>
Added: projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractEntityManagerDelegator.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractEntityManagerDelegator.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractEntityManagerDelegator.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jpa.integration;
+
+import javax.persistence.EntityManager;
+
+/**
+ * A utility class which delegates everything to another EntityManager.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class AbstractEntityManagerDelegator extends JPA2EntityManagerDelegator implements EntityManager
+{
+ private static final long serialVersionUID = 1L;
+}
Added: projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractSessionFactoryDelegator.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractSessionFactoryDelegator.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/AbstractSessionFactoryDelegator.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jpa.integration;
+
+import org.hibernate.SessionFactory;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class AbstractSessionFactoryDelegator extends Hibernate3_5SessionFactoryDelegator implements SessionFactory
+{
+ private static final long serialVersionUID = 1L;
+}
Added: projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_3SessionFactoryDelegator.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_3SessionFactoryDelegator.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_3SessionFactoryDelegator.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jpa.integration;
+
+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 org.hibernate.HibernateException;
+import org.hibernate.Interceptor;
+import org.hibernate.SessionFactory;
+import org.hibernate.StatelessSession;
+import org.hibernate.classic.Session;
+import org.hibernate.engine.FilterDefinition;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.metadata.CollectionMetadata;
+import org.hibernate.stat.Statistics;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class Hibernate3_3SessionFactoryDelegator
+{
+ private static final long serialVersionUID = 1L;
+
+ public void close() throws HibernateException
+ {
+ getSessionFactory().close();
+ }
+
+ @SuppressWarnings({"unchecked", "deprecation"})
+ public void evict(Class persistentClass, Serializable id) throws HibernateException
+ {
+ getSessionFactory().evict(persistentClass, id);
+ }
+
+ @SuppressWarnings({"unchecked", "deprecation"})
+ public void evict(Class persistentClass) throws HibernateException
+ {
+ getSessionFactory().evict(persistentClass);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void evictCollection(String roleName, Serializable id) throws HibernateException
+ {
+ getSessionFactory().evictCollection(roleName, id);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void evictCollection(String roleName) throws HibernateException
+ {
+ getSessionFactory().evictCollection(roleName);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void evictEntity(String entityName, Serializable id) throws HibernateException
+ {
+ getSessionFactory().evictEntity(entityName, id);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void evictEntity(String entityName) throws HibernateException
+ {
+ getSessionFactory().evictEntity(entityName);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void evictQueries() throws HibernateException
+ {
+ getSessionFactory().evictQueries();
+ }
+
+ @SuppressWarnings("deprecation")
+ public void evictQueries(String cacheRegion) throws HibernateException
+ {
+ getSessionFactory().evictQueries(cacheRegion);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map getAllClassMetadata() throws HibernateException
+ {
+ return getSessionFactory().getAllClassMetadata();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map getAllCollectionMetadata() throws HibernateException
+ {
+ return getSessionFactory().getAllCollectionMetadata();
+ }
+
+ @SuppressWarnings("unchecked")
+ 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 Session getCurrentSession() throws HibernateException
+ {
+ return getSessionFactory().getCurrentSession();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set getDefinedFilterNames()
+ {
+ return getSessionFactory().getDefinedFilterNames();
+ }
+
+ public FilterDefinition getFilterDefinition(String filterName) throws HibernateException
+ {
+ return getSessionFactory().getFilterDefinition(filterName);
+ }
+
+ public Reference getReference() throws NamingException
+ {
+ return getSessionFactory().getReference();
+ }
+
+ protected abstract SessionFactory getSessionFactory();
+
+ public Statistics getStatistics()
+ {
+ return getSessionFactory().getStatistics();
+ }
+
+ public boolean isClosed()
+ {
+ return getSessionFactory().isClosed();
+ }
+
+ public Session openSession() throws HibernateException
+ {
+ return getSessionFactory().openSession();
+ }
+
+ public Session openSession(Connection connection, Interceptor interceptor)
+ {
+ return getSessionFactory().openSession(connection, interceptor);
+ }
+
+ public Session openSession(Connection connection)
+ {
+ return getSessionFactory().openSession(connection);
+ }
+
+ public Session openSession(Interceptor interceptor) throws HibernateException
+ {
+ return getSessionFactory().openSession(interceptor);
+ }
+
+ public StatelessSession openStatelessSession()
+ {
+ return getSessionFactory().openStatelessSession();
+ }
+
+ public StatelessSession openStatelessSession(Connection connection)
+ {
+ return getSessionFactory().openStatelessSession(connection);
+ }
+
+}
Added: projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_5SessionFactoryDelegator.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_5SessionFactoryDelegator.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/Hibernate3_5SessionFactoryDelegator.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jpa.integration;
+
+import org.hibernate.Cache;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class Hibernate3_5SessionFactoryDelegator extends Hibernate3_3SessionFactoryDelegator
+{
+ private static final long serialVersionUID = 1L;
+
+ public boolean containsFetchProfileDefition(String profile)
+ {
+ return getSessionFactory().containsFetchProfileDefition(profile);
+ }
+
+ public Cache getCache()
+ {
+ return getSessionFactory().getCache();
+ }
+}
Added: projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA1EntityManagerDelegator.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA1EntityManagerDelegator.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA1EntityManagerDelegator.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jpa.integration;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import javax.persistence.FlushModeType;
+import javax.persistence.LockModeType;
+import javax.persistence.Query;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class JPA1EntityManagerDelegator
+{
+ private static final long serialVersionUID = 1L;
+
+ public void clear()
+ {
+ getEntityManager().clear();
+ }
+
+ public void close()
+ {
+ getEntityManager().close();
+ }
+
+ public boolean contains(Object entity)
+ {
+ return getEntityManager().contains(entity);
+ }
+
+ public Query createNamedQuery(String name)
+ {
+ return getEntityManager().createNamedQuery(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Query createNativeQuery(String sqlString, Class resultClass)
+ {
+ return getEntityManager().createNativeQuery(sqlString, resultClass);
+ }
+
+ public Query createNativeQuery(String sqlString, String resultSetMapping)
+ {
+ return getEntityManager().createNativeQuery(sqlString, resultSetMapping);
+ }
+
+ public Query createNativeQuery(String sqlString)
+ {
+ return getEntityManager().createNativeQuery(sqlString);
+ }
+
+ public Query createQuery(String ejbqlString)
+ {
+ return getEntityManager().createQuery(ejbqlString);
+ }
+
+ public <T> T find(Class<T> entityClass, Object primaryKey)
+ {
+ return getEntityManager().find(entityClass, primaryKey);
+ }
+
+ public void flush()
+ {
+ getEntityManager().flush();
+ }
+
+ public Object getDelegate()
+ {
+ return getEntityManager().getDelegate();
+ }
+
+ protected abstract EntityManager getEntityManager();
+
+ public FlushModeType getFlushMode()
+ {
+ return getEntityManager().getFlushMode();
+ }
+
+ public <T> T getReference(Class<T> entityClass, Object primaryKey)
+ {
+ return getEntityManager().getReference(entityClass, primaryKey);
+ }
+
+ public EntityTransaction getTransaction()
+ {
+ return getEntityManager().getTransaction();
+ }
+
+ public boolean isOpen()
+ {
+ return getEntityManager().isOpen();
+ }
+
+ public void joinTransaction()
+ {
+ getEntityManager().joinTransaction();
+ }
+
+ public void lock(Object entity, LockModeType lockMode)
+ {
+ getEntityManager().lock(entity, lockMode);
+ }
+
+ public <T> T merge(T entity)
+ {
+ return getEntityManager().merge(entity);
+ }
+
+ public void persist(Object entity)
+ {
+ getEntityManager().persist(entity);
+ }
+
+ public void refresh(Object entity)
+ {
+ getEntityManager().refresh(entity);
+ }
+
+ public void remove(Object entity)
+ {
+ getEntityManager().remove(entity);
+ }
+
+ public void setFlushMode(FlushModeType flushMode)
+ {
+ getEntityManager().setFlushMode(flushMode);
+ }
+}
Added: projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA2EntityManagerDelegator.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA2EntityManagerDelegator.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/main/java/org/jboss/ejb3/jpa/integration/JPA2EntityManagerDelegator.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jpa.integration;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.LockModeType;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.QueryBuilder;
+import javax.persistence.metamodel.Metamodel;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class JPA2EntityManagerDelegator extends JPA1EntityManagerDelegator implements EntityManager
+{
+ private static final long serialVersionUID = 1L;
+
+ public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass)
+ {
+ return getEntityManager().createNamedQuery(name, resultClass);
+ }
+
+ public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery)
+ {
+ return getEntityManager().createQuery(criteriaQuery);
+ }
+
+ public <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass)
+ {
+ return getEntityManager().createQuery(qlString, resultClass);
+ }
+
+ public void detach(Object entity)
+ {
+ getEntityManager().detach(entity);
+ }
+
+ public <T> T find(Class<T> entityClass, Object primaryKey, Map<String, Object> properties)
+ {
+ return getEntityManager().find(entityClass, primaryKey, properties);
+ }
+
+ public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode)
+ {
+ return getEntityManager().find(entityClass, primaryKey, lockMode);
+ }
+
+ public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode, Map<String, Object> properties)
+ {
+ return getEntityManager().find(entityClass, primaryKey, lockMode, properties);
+ }
+
+ public EntityManagerFactory getEntityManagerFactory()
+ {
+ return getEntityManager().getEntityManagerFactory();
+ }
+
+ public LockModeType getLockMode(Object entity)
+ {
+ return getEntityManager().getLockMode(entity);
+ }
+
+ public Metamodel getMetamodel()
+ {
+ return getEntityManager().getMetamodel();
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return getEntityManager().getProperties();
+ }
+
+ public QueryBuilder getQueryBuilder()
+ {
+ return getEntityManager().getQueryBuilder();
+ }
+
+ public Set<String> getSupportedProperties()
+ {
+ return getEntityManager().getSupportedProperties();
+ }
+
+ public void lock(Object entity, LockModeType lockMode, Map<String, Object> properties)
+ {
+ getEntityManager().lock(entity, lockMode, properties);
+ }
+
+ public void refresh(Object entity, Map<String, Object> properties)
+ {
+ getEntityManager().refresh(entity, properties);
+ }
+
+ public void refresh(Object entity, LockModeType lockMode)
+ {
+ getEntityManager().refresh(entity, lockMode);
+ }
+
+ public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties)
+ {
+ getEntityManager().refresh(entity, lockMode, properties);
+ }
+
+ public void setProperty(String propertyName, Object value)
+ {
+ getEntityManager().setProperty(propertyName, value);
+ }
+
+ public <T> T unwrap(Class<T> cls)
+ {
+ return getEntityManager().unwrap(cls);
+ }
+
+}
Added: projects/ejb3/trunk/jpa-int/src/test/java/hack/Dummy.java
===================================================================
--- projects/ejb3/trunk/jpa-int/src/test/java/hack/Dummy.java (rev 0)
+++ projects/ejb3/trunk/jpa-int/src/test/java/hack/Dummy.java 2009-10-02 12:48:55 UTC (rev 94268)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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 hack;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.ejb3.jpa.integration.AbstractEntityManagerDelegator;
+
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class Dummy
+{
+ /**
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ InvocationHandler handler = new InvocationHandler()
+ {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ System.out.println(method);
+ return null;
+ }
+ };
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class<?> interfaces[] = { EntityManager.class };
+ final EntityManager delegate = (EntityManager) Proxy.newProxyInstance(loader, interfaces, handler);
+ EntityManager em = new AbstractEntityManagerDelegator()
+ {
+ @Override
+ protected EntityManager getEntityManager()
+ {
+ return delegate;
+ }
+ };
+ em.flush();
+ em.getMetamodel();
+ }
+
+}
More information about the jboss-cvs-commits
mailing list