We are using OJB on a system that has to support a lot of legacy solutions.
The database in this case is SQL Server and the primary keys in the tables
are integers that are auto-numbering (identity in MS SQL language).
Everything but inserts are working just fine. We are using a solution that
is provided in the OJB documentation on getting the value after an insert
(implementing PersistenceBrokerAware and read back in the object in the
afterStore method). Nasty but good for now.
However, while trying to test all of this, it was discovered that OJB is
trying to give a value for these columns on inserts causing an exception.
This value, since it has not been set and is an integer is 0 (zero). MS SQL
Server rightfully complains with an exception of "Cannot insert explicit
value for identity column ... when IDENTITY_INSERT is set to OFF".
Basically, OJB should not be sending or referencing the column in the SQL
that is being used for the insert. We do need, however, to have that column
for reads. The descriptor for these columns have autoincrement="true"
removed so they all look like:
<field-descriptor
id="1"
name="ndx"
column="ndx"
jdbc-type="INTEGER"
primarykey="true"/>
Any ideas on how to pull this off?
+---------------------------------------------------------+
This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose or take any action based on this message or any
information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message.
Thank you for your cooperation.
+---------------------------------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]