-->
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: Stored procrdure with collection
PostPosted: Thu Apr 05, 2007 7:39 am 
Newbie

Joined: Thu Apr 05, 2007 7:26 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2.2

Mapping documents:
Code:
<class name="Event" table="REG">
        <id name="id" column="id">
            <generator class="increment"/>
        </id>
       <set name="it" table="IT">
            <key column="id_reg"/>
            <many-to-many class="User" column="id_user"/>
            <sql-insert callable="true">{call scregister.storeit(?,?)}</sql-insert>
            <sql-delete callable="true">{call scregister.deleteit(?)}</sql-delete>
        </set>
</class>

Code between sessionFactory.openSession() and session.close():
Code:
Event e = (Event) session.load(Event.class,new Long(10));
Set it = new HashSet();
User u = (User)session.load(User.class,new Long(1));
it.add(u);
e.setIt(it);
session.saveOrUpdate(e);

Name and version of the database you are using:
oracle 9i
The generated SQL (show_sql=true):
delete from scregister.IT where id_reg=?
{call scregister.storeit(?,?)}

I want hibernate to call my stored procedure when deleting the set but it doesn't happen. For insert it works all right but not for delete. What i do wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 11:30 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
The positional parameters must match exactly to what Hibernate is expecting. You forgot the ? = part of the delete statement, which should be:
Code:
<sql-delete callable="true">{? = call scregister.deleteit(?)}</sql-delete>


http://www.hibernate.org/hib_docs/v3/re ... erysql-cud


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.