Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2227

OpenJPA doesn't find custom SequenceGenerators

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0.0, 2.1.0, 2.2.0
    • 2.1.2, 2.2.1, 2.3.0
    • kernel
    • None
    • WebSphere Application Server V8.0 and V8.5

    Description

      I'm trying to use a custom SequenceGenerator within an enterprise application using openJPA (providing by WebSphere).

      When defining a custom Sequence a ClassNotFoundException (for the Sequence class) will be thrown when trying to insert data into the database.

      ExampleConfiguration:

      @Entity
      @SequenceGenerator(name="MySequence", sequenceName="org.apache.openjpa.generator.UIDGenerator()")
      public class Customer implements Serializable {
          @Id
          @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MySequence")
          private long id;
      

      The example will produce the stacktrace attached.

      It seems that the wrong class loader is used to instantiate the custom sequence class. A very similar issue seems to be: OPENJPA-758. With JavaSE (JUnit) all is working fine, but after deploying into WAS the Exception will occur.

      I think within the method SequenceMetaData.instantiate(Classloader envLoader) the JavaTypes.classForName() -method with parameter mustExist=false should be used instead of the pure Class.forName() call. But I'm not sure about the Metadata-parameter needed for this method call.

      Attachments

        1. OPENJPA-2227-2.2.x.patch
          1 kB
          Jody Grassel
        2. ClassNotFoundException.txt
          3 kB
          Jens Leisenberg

        Activity

          People

            fyrewyld Jody Grassel
            jensleisenberg Jens Leisenberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: