-->
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: ORA-1006 when using custom sql with @SQLUpdate
PostPosted: Tue Jan 13, 2009 6:58 am 
Newbie

Joined: Fri Jul 25, 2008 4:03 am
Posts: 7
Hi,

I want to make an update just of a few columns of my table. For this case I took the update clause which was generated by hibernate and reduced it to the fields I need.

Then I put the sql in a @SQLUpdate annotation. The sql is used, but it results in a ORA-01006: bind variable does not exist.

I assume that hibernate tries to put in also the other fields as paramters, but there are enough bind variables.

How can I tell hibernate to just update the fields I want to?


My class:

Code:
@Entity
@Table(name="CERTIFICATES")
@SQLUpdate(sql="update CERTIFICATES set active=?, alias=?, password=?, valid_from=?, valid_till=? where id=?")
public class SchufaCertificate {
   
   @Transient
   private Logger log = Logger.getLogger(this.getClass());

   @Id     
   @GeneratedValue(strategy = GenerationType.AUTO)
   private long id;
   
   @Column(name="active")
   private boolean active;
   
   @Temporal(TemporalType.DATE)
   @Column(name="valid_from")
    private Date validFrom;

   @Temporal(TemporalType.DATE)
   @Column(name="valid_till")
    private Date validTill;
   
   @Column(name ="alias", length=500)
   private String alias;

   @Column(name ="password", length=50)
   private String password;
   
   @Lob
   @Column(name = "certificate")
   private String certificate = null;
   
   @Transient
   private String plainCertificate = null;

   @Lob
   @Column(name = "privatekey")
   private byte[] privatekey = null;

       .....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 7:03 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
How about using @Column(updatable = false, ...) instead, to exclude columns which should not be updated?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2009 6:21 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Did that fit your needs?

_________________
-----------------
Need advanced help? http://www.viada.eu


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.