Enabling weaving - problems and advice on migration [message #1863108] |
Tue, 16 January 2024 14:20  |
Eclipse User |
|
|
|
Hi eclipse link team,
We have a enterprise monolith Java application with different modules using JPA/Eclipselink that we want to enable dynamic/static weaving for in order to enable lazy loading for OnetoOne and ManytoOne ORM's, however we have a set of problems. Below is the tech stack we are using,
Core Framework: Jave EE 9
Application Server: Payara 5.28.0
Database: MySQL 5.7 (Percona) with ProxySQL for Read/Write Splitting
Data Access Layer: JPA 2.2 with Eclipselink
We have updated persistence.xml files for all modules to below (for now we are trying dynamic weaving since static weaving has more issues):
<property name="eclipselink.weaving" value="true"/>
Problems:
1) MappedSuperclasses are not getting woven properly since we are seeing below error:
Exception while processing rest request. RootCause =NoSuchMethodError: 'void com.abc.abc.abc.Entity1._persistence_set_id(java.lang.Long)'
notes:
- Entity1 extends Entity2, Entity1 is in module A, and Entity2 is in module B. id(java.lang.Long) is a field in Entity2
- We do not want to change the packaging and move entities in the same module.
2) ManyToMany and OneToMany ORM's are eagerly loaded even though the default should be LAZY.
3) Unit tests/IT tests are picking up the persistence.xml files correctly because i see logging enabled/disabled when I change the configuration, however lazy loading is not getting applied.
Also please let me know if you provide any expert services to help out with this application change.
Thank you,
Sahar
[Updated on: Tue, 16 January 2024 14:29] by Moderator
|
|
|
Re: Enabling weaving - problems and advice on migration [message #1863130 is a reply to message #1863108] |
Wed, 17 January 2024 11:00  |
Eclipse User |
|
|
|
For issue #1, you may have to list the mapped superclass and other entities in moduleB in the persistence.xml. All classes you want picked up for weaving should be listed or in the same jar.
#2: Default is lazy and collection mappings do not require weaving. You'll have to provide more information on what you are seeing; I'd suspect an application issue where something is triggering the collections. Try turning on logging as the query timings can sometimes line up with application events like toString and other method calls that may be triggering the collections.
For #3, you'll have to check how you've enabled dynamic weaving and makes sure it is being run in the unit test environment, see https://eclipse.dev/eclipselink/documentation/4.0/solutions/solutions.html#TESTINGJPA004
Best regards,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.07837 seconds