-->
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: sql-update and parameters
PostPosted: Fri Oct 19, 2007 4:05 am 
Newbie

Joined: Thu Oct 18, 2007 10:38 am
Posts: 7
I use hibernate and oracle. Let's imagine the following stored procedure:
Code:
create or replace FUNCTION xyz_update (
  name IN varchar2,
  id IN NUMBER
) ...


And let's imagine the following mapping:
Code:
<sql-update callable="true">{ ? = call xyz_update(?, ?)}</sql-update>


Now if I do that I always get the orcale error that I'm missing paramter 3 for this function. This is wrong, because I only have 2 parameters.

But if I do:
Code:
<sql-update callable="true">{ ? = call xyz_update(?)}</sql-update>


Oracle tells me that I'm calling the function with the wrong number or arguments.

So it looks to me that:
Hibernate counts all the '?' signs for determining the amount of paramters. It also counts the '? = ..' as paramter, too.

Am I right?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 27, 2007 11:19 am 
Newbie

Joined: Fri Nov 16, 2007 7:36 am
Posts: 2
Location: Poland
Code:
@SQLUpdate(callable=true ,sql="{? = call updateUser(?,?)}")
public class Kartka {

   @Id
   private String imie;
   private String nazwisko;
   private String nothing;
   
        ...


Code:
                Kartka karta  = new Kartka();
      karta.setImie("Krzysiek");
      karta.setNazwisko("nowy");
      karta.setNothing("jakastam"); 
                ...

                Transaction tx = null;
      tx = session.getTransaction();
      tx.begin();
      session.update(karta);
      tx.commit();


How to map attribute imie to first "?" in query. J try use
SQLUpdate(callable=true ,sql="{? = call updateUser(:imie,:nazwisko)}")
but this not working, all attributes are saved to database in random order.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 27, 2007 11:19 am 
Newbie

Joined: Fri Nov 16, 2007 7:36 am
Posts: 2
Location: Poland
any sample of code will be nice see


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.