These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Identity Column being included in insert but no value
PostPosted: Thu Jan 28, 2010 12:02 pm 
Newbie

Joined: Thu Jan 28, 2010 11:44 am
Posts: 3
Hi,

I have an entity bean that uses the Id column with an auto generated value. This is running with MS SQL 2005 and works fine in a standalone application using Jdk 1.6.0_18. When I try to use the same jar inside of NetBeans RCP the insert statements are created incorrectly. The insert includes the ID_COVER as a value that needs to be provide.

The annotations is:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID_COVER")
private Long idCover;

I am using hibernate version 3.2.1 and the matching dependencies from the compatibility matrix. I have enabled the lowest level of logging and cannot see anything that indicates that it has an issue with this field. I am assuming that this is some kind of a runtime classpath issue, but have no idea what I could be missing. Reads and updates work fine.

Any pointers is appreciated.

Michael


Top
 Profile  
 
 Post subject: Re: Identity Column being included in insert but no value
PostPosted: Thu Jan 28, 2010 12:44 pm 
Newbie

Joined: Thu Jan 28, 2010 11:44 am
Posts: 3
I did more digging and it seems that it not generating the wrong SQL, it generates two versions and is picking the wrong version. There is an insert and an identity insert. It is incorrectly picking the insert version.

mvfranz wrote:
Hi,

I have an entity bean that uses the Id column with an auto generated value. This is running with MS SQL 2005 and works fine in a standalone application using Jdk 1.6.0_18. When I try to use the same jar inside of NetBeans RCP the insert statements are created incorrectly. The insert includes the ID_COVER as a value that needs to be provide.

The annotations is:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID_COVER")
private Long idCover;

I am using hibernate version 3.2.1 and the matching dependencies from the compatibility matrix. I have enabled the lowest level of logging and cannot see anything that indicates that it has an issue with this field. I am assuming that this is some kind of a runtime classpath issue, but have no idea what I could be missing. Reads and updates work fine.

Any pointers is appreciated.

Michael


Top
 Profile  
 
 Post subject: Re: Identity Column being included in insert but no value
PostPosted: Thu Jan 28, 2010 1:46 pm 
Newbie

Joined: Thu Jan 28, 2010 11:44 am
Posts: 3
I have no idea why this works, but I changed the order of the fields in my entity bean and hibernate is now picking the insert identity SQL.

I am able to insert my objects fine.

mvfranz wrote:
I did more digging and it seems that it not generating the wrong SQL, it generates two versions and is picking the wrong version. There is an insert and an identity insert. It is incorrectly picking the insert version.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.