Ok, found another way around the issue. If I leave the field in the database as
accepting nulls, and change the order around of my update() and create() so it reads
like:
db.begin();
db.create(user);
db.update(user.getDepartment());
db.commit();
It just throws the DuplicateEntryException, and not the null pointer exception as it
was before. So, as long as I don’t enforce non-nulls in the database it appears to
take care of the problem. Of course this should only be a temporary solution, and am
willing to try and help figure out where the problem is.
-Nick
-----Original Message-----
From: Stein M. Hugubakken [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 20, 2004 9:06 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Duplicate entry problem...
Nick Stuart wrote:
> The I get the error saying that user is linked to another object that
> is not being updated. :(
>
> I only have had this issue with MS-SQL server, it seems. I have run other tests
> (with a whole different program and database server (hsqldb,mysql) mind you) that
> try to cause this error and nothing bad happens.
>
> And I do essentially the same thing as in the helper class, besides updating the
> other objects that are related to the one I am trying to create.
>
Now that I've read your reply again I think I misunderstood when I suggested to try
another jdbc-driver.
You haven't run the exact same test-code on other databases, right?
And you didn't remove the line "db.update(user.getDepartment());" to see if that is
where the problem really is?
Stein
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a
subject of:
unsubscribe castor-dev
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.634 / Virus Database: 406 - Release Date: 3/18/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.634 / Virus Database: 406 - Release Date: 3/18/2004
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev