Nick Stuart wrote:
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.
Does everything works when the user don't exist?
Can you provide me with a small test-case(just some minimal code+sql to recreate the scenario) so I can use it for debugging?
All I have available of databases at the moment is MySQL, but we'll see if it can be solved anyway.
For a temporary workaround try to commit in two stages: db.begin(); db.create(user); db.commit();
db.begin(); db.update(user.getDepartment()); db.commit();
Or, you could try to load the user to see if it's really necessary to create a new one.
Stein
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
