Armin Waibel wrote:
Hi,
Guido Beutler wrote:
NextValImpl is ok for me. There is a database sequence at the pk column which caused my problem.
After setting the readonly attribute for the primary key column at the repository everything worked fine.
hmm, this shouldn't work. If you set readonly the PK field will be not passed to the DB (and the PK will not be set). This only works for identity columns.
??
The database generates the pk value and permits that you can pass a pk value at a insert statement.
Every insert statement, which contains the pk columns, causes a SQL Exception.
This is the reason, why read-only works, I think.
Maybe that I have another problem. I thought that OJB recognizes that a sequence (at database !) is defined
I had a db lock problem with db2 in former times when using NextValImpl but I think that is another problem.
I never used DB2, so sorry I can't help.
I havn't find a way to get the sequence name from db2 yet. So setting the name would currently not work.
Without beeing able to access the db sequence the readonly attribute is the only choice.
Why you need the sequence name from your database? If you set auto-naming=true in the sequence-manager descriptor, OJB will handle all sequence names for you.
http://db.apache.org/ojb/sequencemanager.html#noAutoBuild
If you want to use your own sequence names, you can declare them on field-descriptor level using the 'sequence-name' attribute.
for the column and would not generate inserts with pk columns in it. This seems not to be the case.
Without read-only set at repository, OJB passes a pk with correct value but the statement failed because of the
database sequence.
best regards,
Guido
regards, Armin
Thanks for the hint!!
best regards,
Guido
regards, Armin
Thomas Dudziak wrote:
On Mon, 5 Apr 2004, Guido Beutler wrote:
Hi Tom,
Readonly was a usefull hint. I removed the sequence name at the class descriptor and added a
readonly attribute. I still use nextVal sequence manager. This now works for me.
Thanks !!
I'm not sure that the sequence manager is used at all now. Please try the
SequenceManagerNativeImpl to see whether it works too as it seems to me
to be the more appropriate one in your case.
Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
