-->
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.  [ 2 posts ] 
Author Message
 Post subject: @SQLUpdate problem with AbstractEntityPersister and Version
PostPosted: Wed Sep 29, 2010 5:44 am 
Newbie

Joined: Wed Sep 29, 2010 4:48 am
Posts: 1
hibernate 3.5.3

Code:
@Entity("tablename")
@SQLUpdate(sql="UPDATE tablename SET VERSION=?, param1=?, param2=? WHERE ID=? and (param3 is null)")
public class  TablName{
  @Id
  @Column(name = "ID", scale = 0, precision = 10)
  private Long id;

  @Version
  @Column(name = "VERSION", scale = 0, precision = 10)
  private Long version;
....


Look AbstractEntityPersister, method update
Code:
int index = 1; // starting index

after "dehydrate": index = 5
Code:
index = dehydrate( id, fields, rowId, includeProperty, propertyColumnUpdateable, j, update, session, index );

then
Code:
if ( useVersion && Versioning.OPTIMISTIC_LOCK_VERSION == entityMetamodel.getOptimisticLockMode() ) {
getVersionType().nullSafeSet( update, oldVersion, index, session );


we have 5 params(0-4), but nullSafeSet receive index = 5 and throws SQLexception

where is my mistake?


Top
 Profile  
 
 Post subject: Re: @SQLUpdate problem with AbstractEntityPersister and Version
PostPosted: Thu Sep 30, 2010 8:18 am 
Beginner
Beginner

Joined: Fri Nov 14, 2008 7:34 pm
Posts: 24
you cannot change "version".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.