On the first glance, this seems to be an easy task, but let me explain you the situation:
I have data copies of CSV files from accounts and person. Person - Account a related via a 1:n relationship. I want to import these entities into a mysql database with the help of hibernate. The problem is that there is no knowledge of the foreign key relationship between Person and Account at compile time. That means, i cannot just write:
Code:
// …
@ManyToOne
@JoinColumn(name = "person_id")
public Person getPerson() {
return person;
}
// …
Accountrecords are composed of different attributefields, dependant from the sort of account (SAP accounts have different attributes than AD accounts for instance). The connecttion between ADSAccount and Person is done via the attributes ADSAccount.SAMAccountName und Person.CentralAccount. For SAP accounts, the connecting attributes are SAPAccount.accnt und Person.CentralSAPAccount. That means, the connecting attributes vary from account type to account type. This said, i have a big problem. How can i tell hibernate at compile time how to connect Account and Person, that is, how shall i define the foreign key relationships?
Hope you understand what i mean. If not, pls ask.