1 Reply Latest reply on Apr 2, 2007 6:12 PM by fhh

    Question about sequences and entity ejbs 3.0

    Julien Martin Expert

      Hello,

      I have simplified my problem as follows: I have a three-field table as follows:

      pk key name
      1 1 johm (this is an insert)
      2 1 john (this is an update)
      3 2 Pat (this is an insert)
      

      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).

      Please help!!!

      Thanks in advance,

      Julien Martin.