how to support auto primary key in JES 8.1

Hi,I am migrating a EJB CMP project from jboss 4.0 to sun JES. I can use <unknown-pk> to support auto generated primary key in JBoss. But I don't how to do in Sun JES. Does anybody how to do in Sun Jes?I use oracle 9i data database.Thanks in advance.
[292 byte] By [CornerStone] at [2007-11-26 9:27:25]
# 1
Ref: http://docs.sun.com/app/docs/doc/819-2556/6n4rap8r3?a=viewSection: Automatic Primary Key Generation
KarthikR at 2007-7-7 0:07:20 > top of Java-index,Application & Integration Servers,Application Servers...
# 2

Hi,

thank you for reply.

Suppose I have a column named ID in the database table. According the guideline, I have to remove the ID from CMP field / database column.

Here I got two more questions:

1. Is there possible to specify the database column name manually?

2. If I want to use the ID to do filtering in EJBQL, I need to refer to the field by using beanNmae.id, In this case, I will get a deployment error because the corresponding cmp field is not existing.

Is there any solution / comments for above question. Thank you.

CornerStone at 2007-7-7 0:07:20 > top of Java-index,Application & Integration Servers,Application Servers...
# 3

Here is the answer I got from our expert:

"The column can't be chosen (and as only single PK column is supported, there is nothing to choose from), and no, you can't use the ID in EJB QL because such ID is a completely internal value, will be different if you redeploy and run the app again, and is meaningless to the application other than guarantee a unique value for the PK. "

raccah at 2007-7-7 0:07:20 > top of Java-index,Application & Integration Servers,Application Servers...
# 4

Hi,

Thank you for the reply.

thank you for clarifying the question 1.

For 2nd question,

2. If I want to use the ID to do filtering in EJBQL, I need to refer to the field by using beanNmae.id, In this case, I will get a deployment error because the corresponding cmp field is not existing.

What I want to do is to write a EJBQL like:

<ejb-ql><![CDATA[SELECT OBJECT(schedule) FROM BookingScheduleEntityBean as schedule WHERE schedule.id = ?1 and (schedule.endDate is null or schedule.endDate > ?2.... ]]></ejb-ql>

the schedule.id is the primary key previously. I want to use the auto primary key feature of JES so that I have to remove id CMP filed according to JES's developer guide. But the problem here is that I will got a deployment error if I remove the id CMP field. Because the id is no more a CMP field.

what you claim the "meaningless" is correct for most of case, but in some cases, I got the schedule id and want to use the schedule id to retrieve some other information. Inevitably , I have to write a query like the one mentioned above.

Is there any solution for this problem?

xifeng

CornerStone at 2007-7-7 0:07:20 > top of Java-index,Application & Integration Servers,Application Servers...