Tapestry 5
  1. Tapestry 5
  2. TAP5-1576

JPA Integration 5.3.0 with Primary Key Entity Classes Fails

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.3
    • Fix Version/s: 5.3
    • Component/s: tapestry-jpa
    • Labels:
      None

      Description

      Single Persistence Unit this time, Glassfish 3,1
      This used to work with Tynamo JPA as well.
      Everything works until I introduce a primary key entity reference such as this:

      Thanks!

      --------------- Main Entity --------------------------

      /**
      *

      • @author lprimak
        */
        @Entity
        @Table(name = "webstats")
        @XmlRootElement
        @NamedQueries( { ... }

        )

      @Data
      public class WebStats implements Serializable
      {
      public String getDate()

      { return webStatsPK.getSdate(); }

      public String getStatisticName()

      { return webStatsPK.getSName(); }

      private static final long serialVersionUID = 1L;
      @EmbeddedId
      protected WebStatsPK webStatsPK;
      @Basic(optional = false)
      @NotNull
      @Column(name = "nvisit")
      private long nvisit;
      @Column(name = "ncarrier")
      private Long ncarrier;
      @Column(name = "ntrack")
      private Long ntrack;
      @Column(name = "nadmin")
      private Long nadmin;
      @Column(name = "nother")
      private Long nother;

      public WebStats()
      {
      }

      public WebStats(WebStatsPK webstatsPK)

      { this.webStatsPK = webstatsPK; }

      public WebStats(WebStatsPK webstatsPK, long nvisit)

      { this.webStatsPK = webstatsPK; this.nvisit = nvisit; }

      public WebStats(String sdate, String sName)

      { this.webStatsPK = new WebStatsPK(sdate, sName); }

      }
      --------------------- Embedded Primary Key -----------------------
      /**
      *

      • @author lprimak
        */
        @Embeddable
        @Data
        public class WebStatsPK implements Serializable
        {
        /**
      • */
        private static final long serialVersionUID = 1L;
        @Basic(optional = false)
        @NotNull
        @Size(min = 1, max = 8)
        @Column(name = "sdate")
        private String sdate;
        @Basic(optional = false)
        @NotNull
        @Size(min = 1, max = 50)
        @Column(name = "sName")
        private String sName;

      public WebStatsPK()
      {
      }

      public WebStatsPK(String sdate, String sName)

      { this.sdate = sdate; this.sName = sName; }

      }
      ----------------------------------------------------

      Here is the error:
      SEVERE: Error invoking service contribution method org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(MappedConfiguration, boolean, EntityManagerSource, EntityManagerManager, TypeCoercer, PropertyAccess, LoggerSource): The type [null] is not the expected [EntityType] for the key class [class com.flowlogix.website.entities.WebStatsPK].
      SEVERE: Operations trace:
      SEVERE: [ 1] Constructing instance of page class org.apache.tapestry5.corelib.pages.ExceptionReport
      SEVERE: [ 2] Realizing service ValueEncoderSource
      SEVERE: [ 3] Invoking org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (at TapestryModule.java:2337)
      SEVERE: [ 4] Invoking org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (at TapestryModule.java:2337)
      SEVERE: [ 5] Determining injection value for parameter #1 (java.util.Map)
      SEVERE: [ 6] Collecting mapped configuration for service ValueEncoderSource
      SEVERE: [ 7] Invoking method org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(MappedConfiguration, boolean, EntityManagerSource, EntityManagerManager, TypeCoercer, PropertyAccess, LoggerSource) (at JpaModule.java:180).
      SEVERE: Construction of service ValueEncoderSource failed: Error invoking service builder method org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (at TapestryModule.java:2337) (for service 'ValueEncoderSource'): Error invoking service contribution method org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(MappedConfiguration, boolean, EntityManagerSource, EntityManagerManager, TypeCoercer, PropertyAccess, LoggerSource): The type [null] is not the expected [EntityType] for the key class [class com.flowlogix.website.entities.WebStatsPK].
      java.lang.RuntimeException: Error invoking service builder method org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (at TapestryModule.java:2337) (for service 'ValueEncoderSource'): Error invoking service contribution method org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(MappedConfiguration, boolean, EntityManagerSource, EntityManagerManager, TypeCoercer, PropertyAccess, LoggerSource): The type [null] is not the expected [EntityType] for the key class [class com.flowlogix.website.entities.WebStatsPK].
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker$1.invoke(ServiceBuilderMethodInvoker.java:80)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1082)
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:52)
      at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1082)
      at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
      at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
      at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
      at org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:63)
      at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:54)
      at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
      at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1082)
      at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
      at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
      at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:56)
      at $ValueEncoderSource_122fe8e54dee78bf.delegate(Unknown Source)
      at $ValueEncoderSource_122fe8e54dee78bf.getValueEncoder(Unknown Source)
      at org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl.defaultValueEncoder(ComponentDefaultProviderImpl.java:124)
      at $ComponentDefaultProvider_122fe8e54dee78c4.defaultValueEncoder(Unknown Source)
      at org.apache.tapestry5.corelib.components.Loop.defaultEncoder(Loop.java:311)
      at org.apache.tapestry5.corelib.components.Loop$Shim_122fe8e54dee795d.invoke(Unknown Source)
      at org.apache.tapestry5.internal.plastic.MethodHandleImpl.invoke(MethodHandleImpl.java:48)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodHandleAsMethodAccess.invoke(BridgeClassTransformation.java:84)
      at org.apache.tapestry5.internal.transform.ParameterWorker$InvokeParameterDefaultMethod.advise(ParameterWorker.java:109)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:362)
      at org.apache.tapestry5.internal.transform.ParameterWorker$InvokeLoadOnParmeterConduit.advise(ParameterWorker.java:132)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:362)
      at org.apache.tapestry5.internal.transform.ParameterWorker$InvokeLoadOnParmeterConduit.advise(ParameterWorker.java:132)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:362)
      at org.apache.tapestry5.internal.transform.ParameterWorker$InvokeParameterDefaultMethod.advise(ParameterWorker.java:115)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:362)
      at org.apache.tapestry5.internal.transform.ParameterWorker$InvokeLoadOnParmeterConduit.advise(ParameterWorker.java:132)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:362)
      at org.apache.tapestry5.internal.transform.ParameterWorker$InvokeLoadOnParmeterConduit.advise(ParameterWorker.java:132)
      at org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at org.apache.tapestry5.corelib.components.Loop.containingPageDidLoad(Loop.java)
      at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:135)
      at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:1023)
      at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.containingPageDidLoad(ComponentPageElementImpl.java:858)
      at org.apache.tapestry5.internal.structure.PageImpl.loaded(PageImpl.java:173)
      at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:221)
      at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:206)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1082)
      at org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:205)
      at $PageLoader_122fe8e54dee78a2.loadPage(Unknown Source)
      at org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:87)
      at $PageSource_122fe8e54dee78a1.getPage(Unknown Source)
      at org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:83)
      at $RequestPageCache_122fe8e54dee78a0.get(Unknown Source)
      at $RequestPageCache_122fe8e54dee789a.get(Unknown Source)
      at org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:77)
      at $RequestExceptionHandler_122fe8e54dee79e5.advised$handleRequestException_122fe8e54dee79e7(Unknown Source)
      at $RequestExceptionHandler_122fe8e54dee79e5$Invocation_handleRequestException_122fe8e54dee79e6.proceedToAdvisedMethod(Unknown Source)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils$19$1.proceed(InternalUtils.java:1384)
      at org.tynamo.security.services.SecurityModule$3.advise(SecurityModule.java:258)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils$19.advise(InternalUtils.java:1448)
      at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
      at $RequestExceptionHandler_122fe8e54dee79e5.handleRequestException(Unknown Source)
      at $RequestExceptionHandler_122fe8e54dee787b.handleRequestException(Unknown Source)
      at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:42)
      at $RequestHandler_122fe8e54dee787d.service(Unknown Source)
      at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:1055)
      at $RequestHandler_122fe8e54dee787d.service(Unknown Source)
      at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:1045)
      at $RequestHandler_122fe8e54dee787d.service(Unknown Source)
      at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
      at $RequestHandler_122fe8e54dee787d.service(Unknown Source)
      at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
      at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
      at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
      at $RequestHandler_122fe8e54dee787d.service(Unknown Source)
      at $RequestHandler_122fe8e54dee7871.service(Unknown Source)
      at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:385)
      at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
      at $HttpServletRequestHandler_122fe8e54dee7873.service(Unknown Source)
      at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
      at $HttpServletRequestFilter_122fe8e54dee7870.service(Unknown Source)
      at $HttpServletRequestHandler_122fe8e54dee7873.service(Unknown Source)
      at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:1005)
      at $HttpServletRequestHandler_122fe8e54dee7873.service(Unknown Source)
      at org.tynamo.security.services.impl.SecurityConfiguration$2.call(SecurityConfiguration.java:104)
      at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
      at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
      at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:344)
      at org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:102)
      at $HttpServletRequestFilter_122fe8e54dee786e.service(Unknown Source)
      at $HttpServletRequestHandler_122fe8e54dee7873.service(Unknown Source)
      at $HttpServletRequestHandler_122fe8e54dee786d.service(Unknown Source)
      at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:680)
      Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error invoking service contribution method org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(MappedConfiguration, boolean, EntityManagerSource, EntityManagerManager, TypeCoercer, PropertyAccess, LoggerSource): The type [null] is not the expected [EntityType] for the key class [class com.flowlogix.website.entities.WebStatsPK].
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:102)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:69)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:46)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.addToMappedConfiguration(RegistryImpl.java:595)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getMappedConfiguration(RegistryImpl.java:546)
      at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:126)
      at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$3.invoke(ServiceResourcesImpl.java:123)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1082)
      at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getMappedConfiguration(ServiceResourcesImpl.java:121)
      at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getMappedConfiguration(AbstractServiceCreator.java:144)
      at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$300(AbstractServiceCreator.java:35)
      at org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:107)
      at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:272)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:97)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils$2.invoke(InternalUtils.java:321)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1082)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:325)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:288)
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker$1.invoke(ServiceBuilderMethodInvoker.java:62)
      ... 136 more
      Caused by: java.lang.RuntimeException: Error invoking service contribution method org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(MappedConfiguration, boolean, EntityManagerSource, EntityManagerManager, TypeCoercer, PropertyAccess, LoggerSource): The type [null] is not the expected [EntityType] for the key class [class com.flowlogix.website.entities.WebStatsPK].
      at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:134)
      at org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:88)
      at org.apache.tapestry5.ioc.internal.RegistryImpl$7.run(RegistryImpl.java:599)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:47)
      at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
      ... 159 more
      Caused by: java.lang.IllegalArgumentException: The type [null] is not the expected [EntityType] for the key class [class com.flowlogix.website.entities.WebStatsPK].
      at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entity(MetamodelImpl.java:160)
      at org.apache.tapestry5.jpa.JpaModule.provideValueEncoders(JpaModule.java:193)
      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.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:122)
      ... 164 more

        Activity

        Hide
        Christian Köberl added a comment -

        The problem seems to be that PersistenceUnitInfo#getManagedClassNames gets all mapped classes (including Embeddables), maybe it would be better to call Metamodel#getEntities

        Show
        Christian Köberl added a comment - The problem seems to be that PersistenceUnitInfo#getManagedClassNames gets all mapped classes (including Embeddables), maybe it would be better to call Metamodel#getEntities
        Hide
        Igor Drobiazko added a comment -

        Yes, that seems to be the problem.

        Show
        Igor Drobiazko added a comment - Yes, that seems to be the problem.
        Hide
        Igor Drobiazko added a comment -

        Lenny, can you please provide the persistence unit configuration? I can't reproduce the issue in my tests.

        Show
        Igor Drobiazko added a comment - Lenny, can you please provide the persistence unit configuration? I can't reproduce the issue in my tests.
        Hide
        Lenny Primak added a comment -

        1 <?xml version="1.0" encoding="UTF-8"?>
        2 <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">
        3 <persistence-unit name="Hope" transaction-type="JTA">
        4 <jta-data-source>jdbc/Billing</jta-data-source>
        5 <exclude-unlisted-classes>false</exclude-unlisted-classes>
        6 <properties/>
        7 </persistence-unit>
        8 </persistence>

        Show
        Lenny Primak added a comment - 1 <?xml version="1.0" encoding="UTF-8"?> 2 <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 "> 3 <persistence-unit name="Hope" transaction-type="JTA"> 4 <jta-data-source>jdbc/Billing</jta-data-source> 5 <exclude-unlisted-classes>false</exclude-unlisted-classes> 6 <properties/> 7 </persistence-unit> 8 </persistence>
        Hide
        Lenny Primak added a comment -

        The following patch solves the problem for me:

        Index: src/main/java/org/apache/tapestry5/jpa/JpaModule.java
        ===================================================================
        — src/main/java/org/apache/tapestry5/jpa/JpaModule.java (revision 1147680)
        +++ src/main/java/org/apache/tapestry5/jpa/JpaModule.java (working copy)
        @@ -184,14 +184,10 @@
        {
        final EntityManagerFactory emf = entityManagerSource.getEntityManagerFactory(info.getPersistenceUnitName());

        • for (final String className : info.getManagedClassNames())
          + for(final EntityType<?> entity : emf.getMetamodel().getEntities())
          +// for (final String className : info.getManagedClassNames())
          {
        • final Metamodel metamodel = emf.getMetamodel();
          -
        • final Class<?> clazz = loadClass(info, className);
          -
        • final EntityType<?> entity = metamodel.entity(clazz);
          -
          + final Class<?> clazz = entity.getClass();
          final ValueEncoderFactory factory = new ValueEncoderFactory()
          {
          public ValueEncoder create(final Class type)
        Show
        Lenny Primak added a comment - The following patch solves the problem for me: Index: src/main/java/org/apache/tapestry5/jpa/JpaModule.java =================================================================== — src/main/java/org/apache/tapestry5/jpa/JpaModule.java (revision 1147680) +++ src/main/java/org/apache/tapestry5/jpa/JpaModule.java (working copy) @@ -184,14 +184,10 @@ { final EntityManagerFactory emf = entityManagerSource.getEntityManagerFactory(info.getPersistenceUnitName()); for (final String className : info.getManagedClassNames()) + for(final EntityType<?> entity : emf.getMetamodel().getEntities()) +// for (final String className : info.getManagedClassNames()) { final Metamodel metamodel = emf.getMetamodel(); - final Class<?> clazz = loadClass(info, className); - final EntityType<?> entity = metamodel.entity(clazz); - + final Class<?> clazz = entity.getClass(); final ValueEncoderFactory factory = new ValueEncoderFactory() { public ValueEncoder create(final Class type)
        Hide
        Igor Drobiazko added a comment -

        Thanks, Lenny. I fixed the issue already yesterday but haven't time to commit it.

        FYI: Your patch is incomplete because there is same issue when contributing to ApplicationStateManager service's configuration.

        Show
        Igor Drobiazko added a comment - Thanks, Lenny. I fixed the issue already yesterday but haven't time to commit it. FYI: Your patch is incomplete because there is same issue when contributing to ApplicationStateManager service's configuration.
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #419 (See https://builds.apache.org/job/tapestry-trunk-freestyle/419/)
        TAP5-1576: JPA Integration 5.3.0 with Primary Key Entity Classes Fails

        drobiazko : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1147707
        Files :

        • /tapestry/tapestry5/trunk/tapestry-jpa/src/main/java/org/apache/tapestry5/jpa/JpaModule.java
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #419 (See https://builds.apache.org/job/tapestry-trunk-freestyle/419/ ) TAP5-1576 : JPA Integration 5.3.0 with Primary Key Entity Classes Fails drobiazko : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1147707 Files : /tapestry/tapestry5/trunk/tapestry-jpa/src/main/java/org/apache/tapestry5/jpa/JpaModule.java
        Hide
        Lenny Primak added a comment -

        Thank you - that works perfectly.

        Show
        Lenny Primak added a comment - Thank you - that works perfectly.

          People

          • Assignee:
            Igor Drobiazko
            Reporter:
            Lenny Primak
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development