Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1056

@Auditable seems not to work on eclipse indigo + java 7

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2, 1.5.3, 1.6.0, 1.7.0
    • Fix Version/s: 7.0.0-M1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Oracle JDK 1.7.0_40, eclipse indigo SR2 (20120216-1857), Linux RedHat 6.4

      Description

      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>

        Issue Links

          Activity

          Hide
          romain.manni-bucau Romain Manni-Bucau added a comment -

          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.

          Show
          romain.manni-bucau Romain Manni-Bucau added a comment - 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.

            People

            • Assignee:
              Unassigned
              Reporter:
              shikida leonardo kenji shikida
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development