[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066729#comment-13066729 ] Lenny Primak commented on TAP5-1576: Thank you - that works perfectly. > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3 >Reporter: Lenny Primak >Assignee: Igor Drobiazko > Fix For: 5.3 > > > 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 Tap
[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066728#comment-13066728 ] Hudson commented on TAP5-1576: -- 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 > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3 >Reporter: Lenny Primak >Assignee: Igor Drobiazko > Fix For: 5.3 > > > 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, > Pr
[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066715#comment-13066715 ] Lenny Primak commented on TAP5-1576: 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) > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3, 5.4 >Reporter: Lenny Primak >Assignee: Igor Drobiazko > > 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]
[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066146#comment-13066146 ] Lenny Primak commented on TAP5-1576: 1 2 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 4 jdbc/Billing 5 false 6 7 8 > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3, 5.4 >Reporter: Lenny Primak >Assignee: Igor Drobiazko > > 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 > [Entity
[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066115#comment-13066115 ] Igor Drobiazko commented on TAP5-1576: -- Lenny, can you please provide the persistence unit configuration? I can't reproduce the issue in my tests. > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3, 5.4 >Reporter: Lenny Primak >Assignee: Igor Drobiazko > > 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.buildValueE
[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064902#comment-13064902 ] Igor Drobiazko commented on TAP5-1576: -- Yes, that seems to be the problem. > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3, 5.4 >Reporter: Lenny Primak >Assignee: Igor Drobiazko > > 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)
[jira] [Commented] (TAP5-1576) JPA Integration 5.3.0 with Primary Key Entity Classes Fails
[ https://issues.apache.org/jira/browse/TAP5-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064770#comment-13064770 ] Christian Köberl commented on TAP5-1576: The problem seems to be that PersistenceUnitInfo#getManagedClassNames gets all mapped classes (including Embeddables), maybe it would be better to call Metamodel#getEntities > JPA Integration 5.3.0 with Primary Key Entity Classes Fails > --- > > Key: TAP5-1576 > URL: https://issues.apache.org/jira/browse/TAP5-1576 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa >Affects Versions: 5.3, 5.4 >Reporter: Lenny Primak > > 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.s