Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about sequences and entity ejbs 3.0

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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

Please help!!!

Thanks in advance,

Julien Martin.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a bit confused to what you want?

Do you want both pk and key to always have the same value? If so, why do you have to have both fields?

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic