wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem with OJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with OJB" Watch "Problem with OJB" New topic
Author

Problem with OJB

JORGE IVAN MARMOLEJO
Greenhorn

Joined: Jun 13, 2003
Posts: 1
Hi
I have a problem with an autoincrement field with SQL server database, table is the follow:
create table Person(
id int primary key IDENTITY (1, 1) NOT NULL ,
nombre varchar(30));
in this case OJB intents to insert the id, which generates an error :
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'test' when IDENTITY_INSERT is set to OFF

the same problem occurs with autoincrement fields of Mysql
is there away to tell OJB, not to insert id in the test table, because it's an autoincrement??
Andrew Edwards
Greenhorn

Joined: May 18, 2004
Posts: 10
Old thread but... has anyone come across an answer to this? I am about to come up to a similar problem where it is easier to use mysql autoincrement for key generation.
Andrew Edwards
Greenhorn

Joined: May 18, 2004
Posts: 10
To answer my own question, just in case anyone searching finds this post,

http://db.apache.org/ojb/docu/guides/sequencemanager.html#native
adam eason
Greenhorn

Joined: Sep 02, 2005
Posts: 1
andrew you helped me out, thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with OJB
 
Similar Threads
Problem persisting id field with an autoincrement field
Hibernate @GeneratedValue problem
OJB - Two entries in Table after commit
Hibernate/MSSQL/identity column
Problem with iBATIS + MySQL + auto increment keys