So stupid. I had to enhance my entities for usage with OpenJPA. Only if enhancement tool worked on entities, IdClass and EmbeddedId working properly. The option openjpa.RuntimeUnenhancedClasses = supported does not work for composite keys.
> Am 23.11.2017 um 21:04 schrieb Björn Berg <[email protected]>: > > I am indirectly using OpenJpa with meecrowave-jpa component. @Vetoed does not > help and there is no beans.xml. > Seems to be a problem with all kinds of EmbeddedId or IdClass. > I have added my sample to GitHub: > https://github.com/rollinhand/meecrowave-jpa-sample > <https://github.com/rollinhand/meecrowave-jpa-sample> > > What do you mean with "exclude it from meecrowave option“? > > >> Am 23.11.2017 um 06:32 schrieb Romain Manni-Bucau <[email protected] >> <mailto:[email protected]>>: >> >> Can depend your jpa provider. Maybe try adding @Vetoed on it or exclude it >> from meecrowave option or CDI beans.xml excludes. >> >> Le 22 nov. 2017 23:58, "Björn Berg" <[email protected] >> <mailto:[email protected]>> a écrit : >> One addition because my latest post was not right. It is not Liquibase, it >> is an embedded Id I use in a different class, added to the persistence >> context. >> >> When I remove the class, everything is fine. >> When I add a single @Id annotation, everything is fine. >> >> This is the entity class and its embedded Id: >> >> @Getter >> @Setter >> @Entity >> @Table(name = "PORTFOLIO") >> public class Portfolio { >> @EmbeddedId >> private PortfolioId portfolioId; >> >> @Column(name = "NOMINAL") >> private BigDecimal nominal; >> >> @Column(name = "CURRENCY") >> private String currency; >> >> … >> >> } >> >> @Getter >> @Setter >> @Embeddable >> public class PortfolioId { >> @Temporal(TemporalType.DATE) >> @Column(name = "NAV_DATE", nullable = false) >> private Date navDate; >> >> @Column(name = "ISIN", nullable = false, length = 12) >> private String isin; >> >> public PortfolioId() {} >> … >> } >> >> What’s wrong with it? >> >> Björn >> >> >> >> >> >>> Am 22.11.2017 um 22:00 schrieb Björn Berg <[email protected] >>> <mailto:[email protected]>>: >>> >>> Found the problem. I am using Liquibase CDI extension in my project and a >>> Liquibase producer. >>> If I run migrations before, there seems to be a problem with the datasource >>> and injection of EntityManager. >>> >>> Removing all Liquibase extensions made the project running. >>> >>>> Am 21.11.2017 um 23:38 schrieb Romain Manni-Bucau <[email protected] >>>> <mailto:[email protected]>>: >>>> >>>> Looks like cdi instance is null in this context. Do you have a sample >>>> reproducing it? >>>> >>>> Le 21 nov. 2017 21:27, "Björn Berg" <[email protected] >>>> <mailto:[email protected]>> a écrit : >>>> Hi, >>>> >>>> I have tried to create a small application based on Meecrowave and JPA >>>> extension. But when I always try to persist an entity, it fails with a >>>> NullPointerException which I cannot really drill down to find the root >>>> cause. >>>> >>>> First I thought injected EntityManager is null but logging the >>>> EntityManager call told me, that it really exists. >>>> PersistenceUnitInfoBuilder and DataSource is produced like described on >>>> http://openwebbeans.apache.org/meecrowave/meecrowave-jpa/index.html >>>> <http://openwebbeans.apache.org/meecrowave/meecrowave-jpa/index.html> >>>> >>>> >>>> [...] >>>> >>>> Someone can give me a hint what I am doing wrong? >>>> >>>> Kind regards, >>>> Björn >>>> >>> >> >
