Hi,

don't use 0 use null and it works just fine.
insert into atable (id_col, name) values (null, 'blah')

where your first column is the auto increment field.  Your code may be using 
int to hold the values in the entity bean, which creates a problem, how to 
know when its null rather than a value.  A way round this is to use Integer 
member variables rather than int values, which means you can now have null 
as a value for the member variable.

A simpler mechanism is to just hard code null into the insert - after all 
thats why you have an auto increment column.

Jonathan


>
>At 23:15 8/07/01 -0700, you wrote:
> >i'm using mysql for my database and created an
> >auto-incrementing pk on a table. i wrote an entity
> >bean which creates a row having a pk value of 0
> >"zero". mysql maps the value of 0 "zero" to the
> >last-pk-value + 1. however, when i retrieve my data
> >through ejb, the pk still contains 0 "zero". im using
> >jboss as my ejb-container. any help is gladly
> >appreciated.
> >
> >-L. Yeung
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to