On Tue, 6 Apr 2004, Martin I. Levi wrote: > Hello, > > Having seen there are a few Postgres users out there it may be > interesting to comment a problem we had here. > First of all the software versions we are using are the following: > > PostgreSQL 7.2.1 > OJB 1.0.rc.5 > > On a Debian Linux platform. > > The problem is related to sequences. When we configure OJB to assign > unique values for primary keys and we perform a query like this one: > > "select rows from our_table" (through OJBs ODMG implementation) > > the correct results are shown but a new row is INSERTED in the table > being this row a copy of the first row (id=0) with a new id. > Now, if we perform a the following query: > > "select rows from our_table where id=0" (always through OJBs ODMG > implementation) > > Instead of getting the row with id=0, a new row with a new ID is shown. > This row, which is an exact copy of the row we wanted with a new id, is > also inserted by OJB in our table. > > If we dont perform querys which include the ID=0 row as a result > everything works fine. We really do not use this OJB feature and we > discovered this testing. This bug caused all our application to die > because in our original table definition one of the columns (not the ID > column) was UNIQUE and OJB tried to insert a row with this column > duplicated.
You don't specify a sequence manager (high-low is the default if I'm not mistaken which means that OJB generates the pk value independent from the database), and the Product.id field is autoincrement, but you also have in the database the corresponding column as SERIAL (which means autoincrement on the database side). You could try using the SequenceManagerNativeImpl in which case you should also specify the Product.id field as access='readonly'. Tom --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
