I have simplified my problem as follows: I have a three-field table as follows:
The requirement for one table cannot be changed.
I have a auto generated identity or a sequence for pk.
My question relates to key. As you have noticed key is not unique.
How can I retrieve the value used for the pk for use by key field when I do an insert bearing in mind I currently use an auto generated identity (with DB2). Do I need a sequence? Please advise me on the best strategy.
Please tell me what code I need on the entity bean side (the one that is persisted) and on the session bean side (the one that persists the entity).