Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA @OneToMany join across different persistence units

Tags:

jpa

now, I understand this is not possible, but I can't imagine that it's a problem that is never encountered.

I have two entities in different PUs. I'd like to foreign key from one to the other. I wondered who out there has already encountered this issue, and if they'd found a good solution to it?

like image 793
Alex Collins Avatar asked Feb 22 '23 14:02

Alex Collins


1 Answers

EclipseLink supports Composite Persistence Units, that allow relationships across multiple persistence units.

See, http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Composite_Persistence_Units

Otherwise, you can just map the foreign key as a Basic and query for the objects.

like image 74
James Avatar answered Jun 07 '23 02:06

James