Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Calculated Primary Key
Calculated Primary Key [message #555800] Sat, 28 August 2010 18:03 Go to next message
Eclipse UserFriend
Hi all,

I want to integrate pseudonymization / depseudonymization using JPA. Imagine a one to many relationship between a customer and many orders. The order entity should contain a foreign key of type string. This foreign key is calculated from a Java implementation using fields from the customer entity. This implementation creates the foreign key value from the three fields and extracts the three fields from a given foreign key value.

The customer entity will have a compound primary key class(firstname, lastname, birthdate). The problem is that the key in customer are in this example 3 fields and the reference in the order is one calculated value of this fields. Is there a hook which I could use in EclipseLink? Or do I have to extend EclipseLink? Is this barely possible?

I don't know how to solve this problem unless I want to use the convenient @OneToMany in the customer entity.

Any ideas?

Regards,
Mark
Re: Calculated Primary Key [message #556075 is a reply to message #555800] Mon, 30 August 2010 13:40 Go to previous message
Eclipse UserFriend
EclipseLink allows you to define complex relationships based on an Expression.

See,
http://wiki.eclipse.org/EclipseLink/Examples/JPA/MappingSele ctionCriteria

You can use the fields in the expression to compute a foreign key value.

Previous Topic:Problem with DB2
Next Topic:Lazy is not lazy
Goto Forum:
  


Current Time: Wed Jul 23 10:36:22 EDT 2025

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

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

Back to the top