Hello everybody!
First of all, sorry if my english is poor, i'm brazilian and i'm not used to post in international forums.
Well, i have a problem and i'd like to know if you can help me.
Let's go:
I'm using JPA2 and i have two Persistence Units:
Code:
<persistence-unit name="PU1">
<class>br.com.maua.entity.Client</class>
</persistence-unit>
Code:
<persistence-unit name="PU2">
<class>br.com.maua.entity.Account</class>
</persistence-unit>
A Client can have any number of Accounts, so here we have a @OneToMany relationship. But how you can notice above, they are in different Persistence Unit's, and when i do the deploy, the following exception is throw:
Quote:
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class
This exception is throw because they are in different PU's, right. So, i found this solution:
http://stackoverflow.com/questions/4902215/hiberna...nk-between-2-persistence-unitsBut the problem is that when i persist an Account that belongs to a Client, the Client entity is created in the persistence unit that belongs to Account , and i don't wanna that it happens because the Client information must stay only in your persistence unit.
So, here we go with the question: There's a way to create a relationship between two entitys with different persistence units?
Thanks!