[ 
https://issues.apache.org/jira/browse/TOMEE-1056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13792745#comment-13792745
 ] 

Romain Manni-Bucau commented on TOMEE-1056:
-------------------------------------------

This is not an issue in tomee or openejb. This is an issue in openjpa which 
triggers org.apache.openjpa.event.TransactionEvent#AFTER_BEGIN too early or add 
AuditManager too late (one of both is an issue) to let it work in JTA mode.

> @Auditable seems not to work on eclipse indigo + java 7
> -------------------------------------------------------
>
>                 Key: TOMEE-1056
>                 URL: https://issues.apache.org/jira/browse/TOMEE-1056
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 1.5.2, 1.5.3, 1.6.0, (trunk/tomee)
>         Environment: Oracle JDK 1.7.0_40, eclipse indigo SR2 (20120216-1857), 
> Linux RedHat 6.4
>            Reporter: leonardo kenji shikida
>
> see 
> http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/ref_guide_audit.html
>  for expected behavior
> tested against the following releases
> apache-tomee-1.5.3-20131011.041134-161-plus.tar.gz
> apache-tomee-1.6.0-20130814.041130-146-plus.zip
> apache-tomee-1.6.0-20131011.041119-202-plus.tar.gz
> apache-tomee-1.5.2-plus.tar.gz
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>MyAuditTest>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> package ejb;
> import javax.ejb.Schedule;
> import javax.ejb.Startup;
> import javax.ejb.Stateless;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceContext;
> import entities.SomePersistentEntity;
> @Stateless
> @Startup
> public class MyAuditTest {
>     @PersistenceContext(unitName = "poc")
>     private EntityManager entityManager;
>     @Schedule(minute = "*", hour = "*")
>     public void save(){
>         System.out.println("Saving...");
>         SomePersistentEntity entity = new SomePersistentEntity();
>         entity.setS(String.valueOf(System.currentTimeMillis()));
>         entityManager.persist(entity);
>     }
> }
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>SomePersistentEntity>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> package entities;
> import java.io.Serializable;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import org.apache.openjpa.audit.Auditable;
> @Entity
> @Auditable
> public class SomePersistentEntity implements Serializable {
>     /**
>      *
>      */
>     private static final long serialVersionUID = 6119051520445701552L;
>    
>     @Id
>     @GeneratedValue(strategy = GenerationType.AUTO)
>     private Long id;
>    
>     private String s;
>     public Long getId() {
>         return id;
>     }
>     public void setId(Long id) {
>         this.id = id;
>     }
>     public String getS() {
>         return s;
>     }
>     public void setS(String s) {
>         this.s = s;
>     }
>    
>    
> }
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>persistence.xml>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
>   <persistence-unit name="poc">
>     <jta-data-source>poc1</jta-data-source>
>     <non-jta-data-source>poc2</non-jta-data-source>
>     <properties>
>         <property name="openjpa.jdbc.DBDictionary" 
> value="oracle(maxEmbeddedBlobSize=-1,maxEmbeddedClobSize=-1)"/>
>         <property name="openjpa.jdbc.SynchronizeMappings" 
> value="buildSchema(ForeignKeys=true)"/>
>         <property name="openjpa.Auditor" value="default"/>
>     </properties>
>   </persistence-unit>
> </persistence>



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to