Re: Using OpenJPA with Spring Boot 3?

2022-12-28 Thread Francesco Chicchiriccò

On 28/12/22 10:44, Romain Manni-Bucau wrote:

A bit from memory so can miss a few details but think adding openjpa with
jakarta classifier as a dependency of the plugin does the trick.


That's correct, thank you.

Again, FTR:

    
  org.apache.openjpa
openjpa-maven-plugin
  ${openjpa.version}
  
    
  org.apache.openjpa
  openjpa
  ${openjpa.version}
  jakarta
    
    
  jakarta.persistence
jakarta.persistence-api
  3.1.0
    
    
  jakarta.transaction
jakarta.transaction-api
  2.0.1
    
  
    

Regards.


Le mer. 28 déc. 2022 à 10:40, Francesco Chicchiriccò 
a écrit :


Thank you.

FTR this is my current setup:

root pom.xml:


  org.apache.openjpa
  openjpa
  ${openjpa.version}
  jakarta
  

  org.apache.xbean
  xbean-asm9-shaded


  org.apache.commons
  commons-pool2


org.apache.geronimo.specs
geronimo-jpa_2.2_spec


org.apache.geronimo.specs
geronimo-jta_1.1_spec


org.apache.geronimo.specs
geronimo-jms_1.1_spec

  


core/persistence-jpa/pom.xml:

  
jakarta.persistence
jakarta.persistence-api
  
  
jakarta.transaction
jakarta.transaction-api
  
  
org.apache.openjpa
openjpa
jakarta
  

I am having issues now with entity enhancement.

I see log messages like as

[BuilderThread 0] openjpa.Tool - Enhancer running on type "class
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr".

but afterwards:

[BuilderThread 0] openjpa.Tool - No metadata was found for 134 classes;
they have been enhanced as persistence-aware. If you intended for any of
these classes to be persistence-capable, then this means that OpenJPA could
not find any metadata for those classes.

I guess this is because of the namespace mismatch between
openjpa-maven-plugin and the openjpa dependency as declared above.

Regards.

On 28/12/22 08:52, Romain Manni-Bucau wrote:

Use


https://repo.maven.apache.org/maven2/org/apache/openjpa/openjpa/3.2.2/openjpa-3.2.2-jakarta.jar

and exclude transitive deps.

Le mer. 28 déc. 2022 à 08:45, Francesco Chicchiriccò <

ilgro...@apache.org>

a écrit :


On 27/12/22 17:14, Romain Manni-Bucau wrote:

Yes, think you should either move to openjpa-all shade or generate the
class with asm at build time (guess switching the main dep is easier).

Unfortunately just switching to openjpa-all does not change the errors I
am reporting below.

When I look inside




https://repo1.maven.org/maven2/org/apache/openjpa/openjpa-all/3.2.2/openjpa-all-3.2.2.jar

what should I be able to see exactly? e.g. what would be the effect of

the

relocation settings in

https://github.com/apache/openjpa/blob/master/openjpa/pom.xml#L100

?

In case this option is not viable: would you be able to suggest how to
proceed with asm-based alternative you are mentioning above?
TIA.

Regards.


Le mar. 27 déc. 2022 à 17:06, Maxim Solodovnik 

a

écrit :


Sorry fir top-posting

Maybe we shall release Jakarta version?
As 4.x for ex?

from mobile (sorry for typos ;)


On Tue, Dec 27, 2022, 23:01 Francesco Chicchiriccò <

ilgro...@apache.org

wrote:


On 27/12/22 16:50, Romain Manni-Bucau wrote:

Hi,

Well I guess the jakarta shade should handle jakarta properly else

user

can

use what he wants and finally worse case you can still integrate the
mapping in spring glue code (not sure you have something particular

in

mind

so shouting in the wind ;)).

For instance, I would like to keep these classes [1] working, but

when

I

attempt to build it, I am receiving the following errors:

[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java:[56,55]

cannot access javax.persistence.EntityTransaction
[ERROR]   class file for javax.persistence.EntityTransaction not

found

[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java:[89,34]

no suitable method found for cast(jakarta.persistence.EntityManager)
[ERROR] method


org.apache.openjpa.persistence.OpenJPAPersistence.cast(javax.persistence.EntityManagerFactory)

is not applicable
[ERROR]   (argument mismatch; jakarta.persistence.EntityManager

cannot

be converted to javax.persistence.EntityManagerFactory)
[ERROR] method


org.apache.openjpa.persistence.OpenJPAPersistence.cast(javax.persistence.EntityManager)

is not applicable
[ERROR]   (argument mismatch; jakarta.persistence.EntityManager

cannot

be converted to javax.persistence.EntityManager)
[ERROR] method



Re: Using OpenJPA with Spring Boot 3?

2022-12-28 Thread Romain Manni-Bucau
A bit from memory so can miss a few details but think adding openjpa with
jakarta classifier as a dependency of the plugin does the trick.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le mer. 28 déc. 2022 à 10:40, Francesco Chicchiriccò 
a écrit :

> Thank you.
>
> FTR this is my current setup:
>
> root pom.xml:
>
>
>  org.apache.openjpa
>  openjpa
>  ${openjpa.version}
>  jakarta
>  
>
>  org.apache.xbean
>  xbean-asm9-shaded
>
>
>  org.apache.commons
>  commons-pool2
>
>
> org.apache.geronimo.specs
> geronimo-jpa_2.2_spec
>
>
> org.apache.geronimo.specs
> geronimo-jta_1.1_spec
>
>
> org.apache.geronimo.specs
> geronimo-jms_1.1_spec
>
>  
>
>
> core/persistence-jpa/pom.xml:
>
>  
>jakarta.persistence
>jakarta.persistence-api
>  
>  
>jakarta.transaction
>jakarta.transaction-api
>  
>  
>org.apache.openjpa
>openjpa
>jakarta
>  
>
> I am having issues now with entity enhancement.
>
> I see log messages like as
>
> [BuilderThread 0] openjpa.Tool - Enhancer running on type "class
> org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr".
>
> but afterwards:
>
> [BuilderThread 0] openjpa.Tool - No metadata was found for 134 classes;
> they have been enhanced as persistence-aware. If you intended for any of
> these classes to be persistence-capable, then this means that OpenJPA could
> not find any metadata for those classes.
>
> I guess this is because of the namespace mismatch between
> openjpa-maven-plugin and the openjpa dependency as declared above.
>
> Regards.
>
> On 28/12/22 08:52, Romain Manni-Bucau wrote:
> > Use
> >
> https://repo.maven.apache.org/maven2/org/apache/openjpa/openjpa/3.2.2/openjpa-3.2.2-jakarta.jar
> > and exclude transitive deps.
> >
> > Le mer. 28 déc. 2022 à 08:45, Francesco Chicchiriccò <
> ilgro...@apache.org>
> > a écrit :
> >
> >> On 27/12/22 17:14, Romain Manni-Bucau wrote:
> >>> Yes, think you should either move to openjpa-all shade or generate the
> >>> class with asm at build time (guess switching the main dep is easier).
> >> Unfortunately just switching to openjpa-all does not change the errors I
> >> am reporting below.
> >>
> >> When I look inside
> >>
> >>
> >>
> https://repo1.maven.org/maven2/org/apache/openjpa/openjpa-all/3.2.2/openjpa-all-3.2.2.jar
> >>
> >> what should I be able to see exactly? e.g. what would be the effect of
> the
> >> relocation settings in
> >>
> >> https://github.com/apache/openjpa/blob/master/openjpa/pom.xml#L100
> >>
> >> ?
> >>
> >> In case this option is not viable: would you be able to suggest how to
> >> proceed with asm-based alternative you are mentioning above?
> >> TIA.
> >>
> >> Regards.
> >>
> >>> Le mar. 27 déc. 2022 à 17:06, Maxim Solodovnik 
> a
> >>> écrit :
> >>>
>  Sorry fir top-posting
> 
>  Maybe we shall release Jakarta version?
>  As 4.x for ex?
> 
>  from mobile (sorry for typos ;)
> 
> 
>  On Tue, Dec 27, 2022, 23:01 Francesco Chicchiriccò <
> ilgro...@apache.org
>  wrote:
> 
> > On 27/12/22 16:50, Romain Manni-Bucau wrote:
> >> Hi,
> >>
> >> Well I guess the jakarta shade should handle jakarta properly else
> >> user
> > can
> >> use what he wants and finally worse case you can still integrate the
> >> mapping in spring glue code (not sure you have something particular
> in
> > mind
> >> so shouting in the wind ;)).
> > For instance, I would like to keep these classes [1] working, but
> when
> >> I
> > attempt to build it, I am receiving the following errors:
> >
> > [ERROR]
> >
> >>
> /home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java:[56,55]
> > cannot access javax.persistence.EntityTransaction
> > [ERROR]   class file for javax.persistence.EntityTransaction not
> found
> > [ERROR]
> >
> >>
> /home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java:[89,34]
> > no suitable method found for cast(jakarta.persistence.EntityManager)
> > [ERROR] method
> >
> >>
> org.apache.openjpa.persistence.OpenJPAPersistence.cast(javax.persistence.EntityManagerFactory)
> > is not applicable
> > [ERROR]   (argument mismatch; jakarta.persistence.EntityManager
>  cannot
> > be converted to javax.persistence.EntityManagerFactory)
> > [ERROR] 

Re: Using OpenJPA with Spring Boot 3?

2022-12-28 Thread Francesco Chicchiriccò

Thank you.

FTR this is my current setup:

root pom.xml:

  
    org.apache.openjpa
    openjpa
    ${openjpa.version}
    jakarta
    
  
    org.apache.xbean
    xbean-asm9-shaded
  
  
    org.apache.commons
    commons-pool2
  
  
org.apache.geronimo.specs
geronimo-jpa_2.2_spec
  
  
org.apache.geronimo.specs
geronimo-jta_1.1_spec
  
  
org.apache.geronimo.specs
geronimo-jms_1.1_spec
  
    
  

core/persistence-jpa/pom.xml:

    
  jakarta.persistence
  jakarta.persistence-api
    
    
  jakarta.transaction
  jakarta.transaction-api
    
    
  org.apache.openjpa
  openjpa
  jakarta
    

I am having issues now with entity enhancement.

I see log messages like as

[BuilderThread 0] openjpa.Tool - Enhancer running on type "class 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr".

but afterwards:

[BuilderThread 0] openjpa.Tool - No metadata was found for 134 classes; they 
have been enhanced as persistence-aware. If you intended for any of these 
classes to be persistence-capable, then this means that OpenJPA could not find 
any metadata for those classes.

I guess this is because of the namespace mismatch between openjpa-maven-plugin 
and the openjpa dependency as declared above.

Regards.

On 28/12/22 08:52, Romain Manni-Bucau wrote:

Use
https://repo.maven.apache.org/maven2/org/apache/openjpa/openjpa/3.2.2/openjpa-3.2.2-jakarta.jar
and exclude transitive deps.

Le mer. 28 déc. 2022 à 08:45, Francesco Chicchiriccò 
a écrit :


On 27/12/22 17:14, Romain Manni-Bucau wrote:

Yes, think you should either move to openjpa-all shade or generate the
class with asm at build time (guess switching the main dep is easier).

Unfortunately just switching to openjpa-all does not change the errors I
am reporting below.

When I look inside


https://repo1.maven.org/maven2/org/apache/openjpa/openjpa-all/3.2.2/openjpa-all-3.2.2.jar

what should I be able to see exactly? e.g. what would be the effect of the
relocation settings in

https://github.com/apache/openjpa/blob/master/openjpa/pom.xml#L100

?

In case this option is not viable: would you be able to suggest how to
proceed with asm-based alternative you are mentioning above?
TIA.

Regards.


Le mar. 27 déc. 2022 à 17:06, Maxim Solodovnik  a
écrit :


Sorry fir top-posting

Maybe we shall release Jakarta version?
As 4.x for ex?

from mobile (sorry for typos ;)


On Tue, Dec 27, 2022, 23:01 Francesco Chicchiriccò 
On 27/12/22 16:50, Romain Manni-Bucau wrote:

Hi,

Well I guess the jakarta shade should handle jakarta properly else

user

can

use what he wants and finally worse case you can still integrate the
mapping in spring glue code (not sure you have something particular in

mind

so shouting in the wind ;)).

For instance, I would like to keep these classes [1] working, but when

I

attempt to build it, I am receiving the following errors:

[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java:[56,55]

cannot access javax.persistence.EntityTransaction
[ERROR]   class file for javax.persistence.EntityTransaction not found
[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java:[89,34]

no suitable method found for cast(jakarta.persistence.EntityManager)
[ERROR] method


org.apache.openjpa.persistence.OpenJPAPersistence.cast(javax.persistence.EntityManagerFactory)

is not applicable
[ERROR]   (argument mismatch; jakarta.persistence.EntityManager

cannot

be converted to javax.persistence.EntityManagerFactory)
[ERROR] method


org.apache.openjpa.persistence.OpenJPAPersistence.cast(javax.persistence.EntityManager)

is not applicable
[ERROR]   (argument mismatch; jakarta.persistence.EntityManager

cannot

be converted to javax.persistence.EntityManager)
[ERROR] method


org.apache.openjpa.persistence.OpenJPAPersistence.cast(javax.persistence.Query)

is not applicable
[ERROR]   (argument mismatch; jakarta.persistence.EntityManager

cannot

be converted to javax.persistence.Query)
[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java:[46,61]

cannot access javax.persistence.spi.PersistenceProvider
[ERROR]   class file for javax.persistence.spi.PersistenceProvider not
found
[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java:[122,46]

incompatible types:


java.lang.Class

cannot be converted to java.lang.Class
[ERROR]


/home/ilgrosso/work/syncope/fork/core/persistence-jpa/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java:[127,39]

incompatible types:
java.lang.Class
cannot be converted to java.lang.Class