Hello Robert,

in JBoss-3.0 you have no chance to achieve it.
Since version 3.2, JBoss supports unknown primary keys.
Currently, autoincrement is supported for MySQL only. If you use
JDK1.4 then you can make use of JDBC3 getGeneratedKeys. You'll need
just setup the table to generate the primary key and configure unknown
primary key for cmp bean.

Using CMP, you have other alternatives, though:
- UUIDKeyGenerator for UUID keys;
- custom sql to fetch the next key value (for DBs that support
sequences);

alex

Tuesday, October 15, 2002, 11:21:02 PM, you wrote:

RM> Hi - 

RM> I have a table that has a NUMERIC primary key that is defined as an IDENTITY
RM> key.  The primary key column is defined such that the database automatically
RM> sets the primary key on insert to the next incremental value.  The user is
RM> not allowed to set the key to any value or the database will return an
RM> error.

RM> My problem is that I have defined a CMP bean that maps to this table, but I
RM> cannot get a create to work.  If I call a create which includes the primary
RM> key, the database throws an exception because I am not allowed to set the
RM> value.  If I call a create method that does not take the primary key, the
RM> database throws an exception because JBoss is trying to set the primary key
RM> to null.

RM> My question is - is there any way to tell JBoss that this primary key is
RM> managed by the database and thus should not be written to?  

RM> How do people typically handle working with tables with identity keys?

RM> By the way, I am using JBoss 3.0.2 and Sybase Adaptive Server Enterprise 12.

RM> Thanks.

RM> Robert


-- 
Best regards,
 Alex Loubyansky




-------------------------------------------------------
This sf.net email is sponsored by: viaVerio will pay you up to
$1,000 for every account that you consolidate with us.
http://ad.doubleclick.net/clk;4749864;7604308;v?
http://www.viaverio.com/consolidator/osdn.cfm
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to