Hi,
I've got a problem with primary key (also auto increment). I've searched the
mailinglist and I have seen titles describing my problem but they don't seem to exist
in the archive any more.
I've defined a simple class and used the AutoCreatorDb.autoCreate to create neccesary
tabled (including internal). Then if I use:
dbobj dbo = new dbobj();
dbo.setActivity("Hello world activity");
dbo.setActivity2("Next activity");
dbo.setName("The name of the object");
broker.beginTransaction();
broker.store(dbo); // the Id in the class is the
pk (autoincrement)
broker.commitTransaction();
i get the following exception
"[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value
for identity column in table 'DBOBJ' when IDENTITY_INSERT is set to OFF."
I can turn this feature off (or rather on) in the session by e.g.
"BEGIN TRANSACTION
SET IDENTITY_INSERT dbo.DBOBJ ON
INSERT INTO DBOBJ(ID,ACTIVITYNAME,ACTIVITY,ACTIVITY2)
VALUES(1221,'kalle','kobra','fiffen');
COMMIT"
Have I misconfigured something. I'm using the following:
Microsoft SQLServer 2000 JDBC 4 driver
Configuration for the default driver (the one and only I use for the ojb):
"
<jdbc-connection-descriptor
jcd-alias="default"
default-connection="true"
platform="MsSQLServer"
jdbc-level="2.0"
driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
protocol="jdbc"
subprotocol="microsoft:sqlserver"
dbalias="//localhost:1433;DatabaseName=OJB;SelectMethod=cursor"
username="*******"
password="*******"
batch-mode="false"
useAutoCommit="1"
ignoreAutoCommitExceptions="false">
<connection-pool maxActive="21" validationQuery="" />
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
<attribute attribute-name="grabSize" attribute-value="20"/>
</sequence-manager>
</jdbc-connection-descriptor>
"
Many Regards,
Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]