Author: rmannibucau Date: Fri Oct 3 14:43:33 2014 New Revision: 1629214 URL: http://svn.apache.org/r1629214 Log: using javax.transaction.Transactional
Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/AbstractGenericJpaRepository.java tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/EntityManagerProducer.java tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/JpaFeedbackRepository.java tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/service/DomainService.java tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/beans.xml tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/persistence.xml tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/webapp/pages/index.xhtml tomee/tomee/trunk/examples/deltaspike-fullstack/src/test/java/org/superbiz/deltaspike/test/PageBeanTest.java Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/AbstractGenericJpaRepository.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/AbstractGenericJpaRepository.java?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/AbstractGenericJpaRepository.java (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/AbstractGenericJpaRepository.java Fri Oct 3 14:43:33 2014 @@ -41,7 +41,7 @@ public abstract class AbstractGenericJpa { Class currentClass = getClass(); - if (currentClass.getName().contains("$$")) + while (currentClass.getName().contains("$$")) { //we are in a proxy currentClass = currentClass.getSuperclass(); } Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/EntityManagerProducer.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/EntityManagerProducer.java?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/EntityManagerProducer.java (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/EntityManagerProducer.java Fri Oct 3 14:43:33 2014 @@ -20,32 +20,18 @@ package org.superbiz.deltaspike.reposito import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.RequestScoped; -import javax.enterprise.inject.Default; -import javax.enterprise.inject.Disposes; import javax.enterprise.inject.Produces; import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.PersistenceUnit; +import javax.persistence.PersistenceContext; @ApplicationScoped -public class EntityManagerProducer -{ - @PersistenceUnit(unitName = "demoApplicationPU") - private EntityManagerFactory entityManagerFactory; +public class EntityManagerProducer { + @PersistenceContext(unitName = "demoApplicationPU") + private EntityManager entityManager; @Produces - @Default @RequestScoped - public EntityManager create() - { - return this.entityManagerFactory.createEntityManager(); - } - - public void dispose(@Disposes @Default EntityManager entityManager) - { - if (entityManager.isOpen()) - { - entityManager.close(); - } + public EntityManager create() { + return entityManager; } } Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/JpaFeedbackRepository.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/JpaFeedbackRepository.java?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/JpaFeedbackRepository.java (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/repository/jpa/JpaFeedbackRepository.java Fri Oct 3 14:43:33 2014 @@ -18,11 +18,12 @@ */ package org.superbiz.deltaspike.repository.jpa; -import org.apache.deltaspike.jpa.api.transaction.Transactional; import org.superbiz.deltaspike.domain.Feedback; import org.superbiz.deltaspike.repository.FeedbackRepository; import org.superbiz.deltaspike.repository.Repository; +import javax.transaction.Transactional; + @Transactional @Repository public class JpaFeedbackRepository extends AbstractGenericJpaRepository<Feedback> implements FeedbackRepository Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/service/DomainService.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/service/DomainService.java?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/service/DomainService.java (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/java/org/superbiz/deltaspike/service/DomainService.java Fri Oct 3 14:43:33 2014 @@ -18,10 +18,9 @@ */ package org.superbiz.deltaspike.service; -import org.apache.deltaspike.jpa.api.transaction.Transactional; - import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Stereotype; +import javax.transaction.Transactional; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/beans.xml URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/beans.xml?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/beans.xml (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/beans.xml Fri Oct 3 14:43:33 2014 @@ -21,4 +21,7 @@ <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> + <alternatives> + <class>org.apache.deltaspike.jpa.impl.transaction.EnvironmentAwareTransactionStrategy</class> + </alternatives> </beans> \ No newline at end of file Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/persistence.xml URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/persistence.xml?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/persistence.xml (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/resources/META-INF/persistence.xml Fri Oct 3 14:43:33 2014 @@ -23,25 +23,23 @@ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> - <persistence-unit name="demoApplicationPU" transaction-type="RESOURCE_LOCAL"> - <!-- needed by tomee 1.6.0+--> - <non-jta-data-source>demoDS</non-jta-data-source> + <persistence-unit name="demoApplicationPU"> + <!-- @MappedSuperclass classes - see OPENJPA-1926 --> + <class>org.superbiz.deltaspike.domain.AbstractDomainObject</class> - <!-- config of (non-)jta-data-source isn't needed if there is just one --> + <!-- entities --> + <class>org.superbiz.deltaspike.domain.User</class> + <class>org.superbiz.deltaspike.domain.Feedback</class> + <class>org.superbiz.deltaspike.domain.Comment</class> - <!-- @MappedSuperclass classes - see OPENJPA-1926 --> - <class>org.superbiz.deltaspike.domain.AbstractDomainObject</class> + <exclude-unlisted-classes>true</exclude-unlisted-classes> - <!-- entities --> - <class>org.superbiz.deltaspike.domain.User</class> - <class>org.superbiz.deltaspike.domain.Feedback</class> - <class>org.superbiz.deltaspike.domain.Comment</class> - - <properties> - <property name="openjpa.DataCache" value="true"/> - <property name="openjpa.DynamicEnhancementAgent" value="true"/> - <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> - <property name="openjpa.jdbc.QuerySQLCache" value="true(EnableStatistics=true)"/> - </properties> - </persistence-unit> + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + <!-- + <property name="openjpa.DataCache" value="true"/> + <property name="openjpa.jdbc.QuerySQLCache" value="true(EnableStatistics=true)"/> + --> + </properties> + </persistence-unit> </persistence> \ No newline at end of file Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/webapp/pages/index.xhtml URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/webapp/pages/index.xhtml?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/webapp/pages/index.xhtml (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/main/webapp/pages/index.xhtml Fri Oct 3 14:43:33 2014 @@ -38,7 +38,6 @@ <li>@GroupedConversationScoped</li> <li>Manual conversation handling</li> <li>Secured pages (AccessDecisionVoter)</li> - <li>@Transactional</li> <li>I18n (type-safe messages)</li> <li>Dependency-Injection for JSR303 (BV) constraint-validators</li> <li>Dependency-Injection for JSF phase-listeners</li> Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/src/test/java/org/superbiz/deltaspike/test/PageBeanTest.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/src/test/java/org/superbiz/deltaspike/test/PageBeanTest.java?rev=1629214&r1=1629213&r2=1629214&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/src/test/java/org/superbiz/deltaspike/test/PageBeanTest.java (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/src/test/java/org/superbiz/deltaspike/test/PageBeanTest.java Fri Oct 3 14:43:33 2014 @@ -18,10 +18,10 @@ */ package org.superbiz.deltaspike.test; -import junit.framework.Assert; import org.apache.deltaspike.cdise.api.ContextControl; import org.apache.deltaspike.core.spi.scope.window.WindowContext; import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.superbiz.deltaspike.WebappMessageBundle;