Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Enabling weaving - problems and advice on migration (Problems with enabling weaving in order to fetch entities lazily)
Enabling weaving - problems and advice on migration [message #1863108] Tue, 16 January 2024 19:20 Go to next message
Sahar Rahmatian is currently offline Sahar RahmatianFriend
Messages: 2
Registered: December 2023
Junior Member
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 19:29]

Report message to a moderator

Re: Enabling weaving - problems and advice on migration [message #1863130 is a reply to message #1863108] Wed, 17 January 2024 16:00 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 54
Registered: December 2021
Member


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
Previous Topic:Globally map boolean fields onto smallint in Postgres
Next Topic:Recommended way to model money (jsr354) and query by amount or by currency ?
Goto Forum:
  


Current Time: Sun Apr 28 15:00:49 GMT 2024

Powered by FUDForum. Page generated in 0.02690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top