[jboss-user] [EJB 3.0] - Question about sequences and entity ejbs 3.0

balteo do-not-reply at jboss.com
Mon Apr 2 08:41:52 EDT 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033672#4033672

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033672



More information about the jboss-user mailing list