db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén <mka...@apache.org>
Subject Re: primary key problem sql server
Date Mon, 20 Jun 2005 09:46:18 GMT
Alessandro Colantoni wrote:
> I'm using ojb 1.0.1 with sql server.
>  When I store an object, and then I delete it directly on the db I can't 
> insert it a second time.
>  Before storing I use to check if an object with the same key exists.
> ojb doesn't detect any object with the same key (correctly... I deleted it)
> But when storing it catch a sql server exception because primary key already 
> exists.
> Is it a limit of microsoft sql server (it keeps primary key somewhere?) or 
> I'm doing something wrong?

This sounds like a transaction isolation problem. If you use the PB API with
OJB without the two-level cache you will not have any transaction isolation
and a delete will be directly visible in the cache before commit.

However, if you don't use auto-commit on the Connection to MSSQL the database
DELETE will not be performed until COMMIT.

What is your auto-commit setting in repository_database.xml and which OJB API
are you using?

Regards,
  Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Mime
View raw message