Hi Ebenezer

Idea is to add
https://github.com/apache/openjpa/blob/08bb3a5a0e7573622aa6dc25763cb6513095093b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java
to a classloader supporting it - tomcat or jetty ones for instance in
spring boot land.

It is automatically done using jpa container api -
createContainerEntityManagerFactory().

Can you try that to setup that in spring?

Le lun. 6 mai 2019 à 02:05, Ebenezer Graham <[email protected]> a
écrit :

> Hello Romain,
>
> Thank you for your reply. I did a little bit of reading on the options you
> gave and I would like to go with the class transformer option.
>
> Can you please elaborate on how to achieve this in spring?
>
> Regards.
>
> On Sun, 5 May 2019 at 21:58, Romain Manni-Bucau <[email protected]>
> wrote:
>
> > Hi Ebenezer
> >
> > I was using
> >
> >
> https://rmannibucau.wordpress.com/2016/03/24/enhance-openjpa-entities-with-gradle/
> > but you can also add openjpa.jar as a javaagent on the jvm.
> >
> > With spring you would need a custom ClassFileTransformer, not sure it
> would
> > be the simplest so maybe give a try to the two previous options first.
> >
> > Hope it helps,
> >
> > Romain
> >
> > Le dim. 5 mai 2019 à 19:39, Ebenezer Graham <[email protected]> a
> > écrit :
> >
> > > Hello Devs,
> > >
> > > I am an Apache Fineract CN contributor currently working on migrating
> the
> > > project's ORM from Hibernate to OpenJPA (more on the issue
> > > <
> > >
> >
> https://jira.apache.org/jira/projects/FINCN/issues/FINCN-2?filter=allopenissues
> > > >
> > > ).
> > >
> > >
> > >
> >
> https://github.com/ebenezergraham/fineract-cn-postgresql/commit/c10a1e77c3a290c1faa671621baf6c6037ba260a
> > >
> > > I want to know how to dynamically enhance entity classes for each
> > > microservice's entity without having to hardcode the configuration in
> an
> > > XML.
> > >
> > > The aim is to do the enhancement with spring or gradle. I would
> > appreciate
> > > it if someone could share their experience on how to handle this (a
> > better
> > > way of doing this
> https://openjpa.apache.org/enhancement-with-maven.html
> > > with gradle, a plugin or spring boot autoconfiguration).
> > >
> > > A brief overview, the project has a PostgreSQL library and a
> provisioner
> > > microservice which provides persistence functionalities to 13 other
> > > microservices. The goal is to configure the enhancement once in the
> > > PostgreSQL library - a one size fits all approach.
> > >
> > > The above issue has led to this error(full log here:
> > > https://pastebin.com/kGQu4qLH)
> > >
> > > Error creating bean with name 'jpaMappingContext': Invocation of init
> > > method failed; nested exception is <openjpa-2.4.1-r422266:1730418 fatal
> > > user error> org.apache.openjpa.util.MetaDataException: The type "class
> > > org.apache.fineract.cn.customer.internal.repository.PortraitEntity"
> has
> > > not
> > > been enhanced.
> > >
> > > *Regards,*
> > >
> > > *Ebenezer Graham*
> > >
> >
>

Reply via email to