Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Context-sensitive composite primary keys(Generation of context-sensitive composite primary keys)
Context-sensitive composite primary keys [message #1201188] Thu, 21 November 2013 16:16
Jürgen  Krey is currently offline Jürgen Krey
Messages: 4
Registered: July 2009
Location: Cologne
Junior Member
I am looking for support for generating a special kind composite primary keys.
The general table design assumes that all tables use logical PKs, ie. there are mostly strings concatenated with consecutive number, eg. "ORDER1", "ORDER2", .. for order entities.

The difficult part is when it comes to relations:
the primary key of an "order item" entity is composed of
the primary of the reeferenced order entity and another consecutive number, ie.
Order 1:
- Order Item 1 has PK ("ORDER1", 1)
- Order Item 2 has PK ("ORDER1", 2) and so on.

If I want to generate composite primary keys for order items, i have to
find the maximum pk index of "ORDER1" order items and increment by '1'.
This is a kind of "context-sensitive" sequence generator, because it might
need the context of tzhe referenced entity, at least if i need strictly consecutive numbers:-(

Even worse: Connecting two entities means, that key generation
for newly created JPA entities must be finished before the objects can be connected.
This looks pretty much like a 2 phase approach.

Do you any eclipseLink extension for my composite key generation problem?


best regards
Juergen
Previous Topic:How to create History for @ElementCollection?
Next Topic:isLoaded NullPointerException
Goto Forum:
  


Current Time: Thu Oct 23 03:12:27 GMT 2014

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

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