Spring Framework
  1. Spring Framework
  2. SPR-6408

Add full support for JPA 2.0 PersistenceUnitInfo

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.1
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      javax.persistence.spi.PersistenceUnitInfo add three methods in JPA2

      @Override
      public String getPersistenceXMLSchemaVersion()

      { return "1.0"; }

      @Override
      public SharedCacheMode getSharedCacheMode()

      { return SharedCacheMode.NONE; }

      @Override
      public ValidationMode getValidationMode()

      { return ValidationMode.NONE; }

      please add it to org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo

        Issue Links

          Activity

          Hide
          Keith Donald added a comment -

          The reason the snapshot label is x.y.z.BUILD-SNAPSHOT instead of the Maven 2 standard x.y.z-SNAPSHOT, is because x.y.z-SNAPSHOT is not a valid OSGi version number, and all Spring releases since 3.0.0.M1 use OSGi version naming format (which Maven 3 is also adopting). x.y.z.BUILD-SNAPSHOT is a good "new standard" that is OSGi compliant and recognized by existing versions of Maven. I'm going to update my blog with a note on this.

          Show
          Keith Donald added a comment - The reason the snapshot label is x.y.z.BUILD-SNAPSHOT instead of the Maven 2 standard x.y.z-SNAPSHOT, is because x.y.z-SNAPSHOT is not a valid OSGi version number, and all Spring releases since 3.0.0.M1 use OSGi version naming format (which Maven 3 is also adopting). x.y.z.BUILD-SNAPSHOT is a good "new standard" that is OSGi compliant and recognized by existing versions of Maven. I'm going to update my blog with a note on this.
          Hide
          Phill Moran added a comment -

          Is this really fixed I get the same error for OpenJPA mentioned above for JDK1.6?

          Show
          Phill Moran added a comment - Is this really fixed I get the same error for OpenJPA mentioned above for JDK1.6?
          Hide
          Juergen Hoeller added a comment -

          What error are you getting exactly? We haven't tested JPA 2.0 with OpenJPA yet but I would expect it to work with Spring 3.0.1 as well...

          Juergen

          Show
          Juergen Hoeller added a comment - What error are you getting exactly? We haven't tested JPA 2.0 with OpenJPA yet but I would expect it to work with Spring 3.0.1 as well... Juergen
          Hide
          Phill Moran added a comment -

          I get this error (using OpenJPA2.0-beta:

          Caused by: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
          at org.apache.openjpa.persistence.PersistenceUnitInfoImpl.toOpenJPAProperties(PersistenceUnitInfoImpl.java:457)
          at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:313)
          at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:158)
          at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
          at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
          at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
          at ca.BidSpec.emall.application.BidspecContextConfiguration.entityManagerFactory(BidspecContextConfiguration.java:139)
          at ca.BidSpec.emall.application.BidspecContextConfiguration$$EnhancerByCGLIB$$7378aded.CGLIB$entityManagerFactory$6(<generated>)
          at ca.BidSpec.emall.application.BidspecContextConfiguration$$EnhancerByCGLIB$$7378aded$$FastClassByCGLIB$$80b293df.invoke(<generated>)
          at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
          at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:210)
          at ca.BidSpec.emall.application.BidspecContextConfiguration$$EnhancerByCGLIB$$7378aded.entityManagerFactory(<generated>)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146)
          ... 75 more

          Show
          Phill Moran added a comment - I get this error (using OpenJPA2.0-beta: Caused by: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode; at org.apache.openjpa.persistence.PersistenceUnitInfoImpl.toOpenJPAProperties(PersistenceUnitInfoImpl.java:457) at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:313) at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:158) at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308) at ca.BidSpec.emall.application.BidspecContextConfiguration.entityManagerFactory(BidspecContextConfiguration.java:139) at ca.BidSpec.emall.application.BidspecContextConfiguration$$EnhancerByCGLIB$$7378aded.CGLIB$entityManagerFactory$6(<generated>) at ca.BidSpec.emall.application.BidspecContextConfiguration$$EnhancerByCGLIB$$7378aded$$FastClassByCGLIB$$80b293df.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:210) at ca.BidSpec.emall.application.BidspecContextConfiguration$$EnhancerByCGLIB$$7378aded.entityManagerFactory(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) ... 75 more
          Hide
          Juergen Hoeller added a comment -

          I'm pretty sure you simply have an old JPA 1.0 API jar on your classpath, since your exception indicates that the method is missing on the JPA PersistenceUnitInfo interface itself.

          So make sure that you're using the JPA 2.0 API jar, then everything should work fine. I've tested January's OpenJPA 2.0 beta release locally, and our integration tests pass against it.

          Juergen

          Show
          Juergen Hoeller added a comment - I'm pretty sure you simply have an old JPA 1.0 API jar on your classpath, since your exception indicates that the method is missing on the JPA PersistenceUnitInfo interface itself. So make sure that you're using the JPA 2.0 API jar, then everything should work fine. I've tested January's OpenJPA 2.0 beta release locally, and our integration tests pass against it. Juergen

            People

            • Assignee:
              Juergen Hoeller
              Reporter:
              zhouyanming
              Last updater:
              Trevor Marshall
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 8 weeks, 6 days ago