SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Amardeep Salkar
Ranch Hand
Joined: May 22, 2008
Posts: 46
posted
0
Use This code in your Action Class or DAO Class. SessionImplementor is an Interface which are used to for collable statement you should import SessionImplementor.... /* import org.hibernate.engine.SessionImplementor;
SessionFactory sf = new Configuration().configure().buildSessionFactory(); session =sf.openSession(); SessionImplementor sesImp=(SessionImplementor) session; CallableStatement cs=null; PreparedStatement ps = null; // for delete.. // for Insert .. // Call any StoreProcedure OR Functions... cs = sesImp.getBatcher().prepareCallableStatement(" {call StoreProcedureFunction()}"); cs.executeUpdate(); tx.commit(); */
Its work fine.... [ August 08, 2008: Message edited by: Amardeep Salkar ]
Hanna Habashy
Ranch Hand
Joined: Aug 20, 2003
Posts: 532
posted
0
Salkar:
Thank you for your reply, however it didn't answer my question.
I am trying to use <sql-delete />, <sql-insert/>, and <sql-update/> tags. Just like in the Hibernate reference manual section 16.3.
I couldn't find any example on how to set the in/out parameters.
In this particular place you don't set the in/out parameters. Hibernate under the covers does this. Usually when Hibernate creates a SessionFactory and reads the config files it creates insert/update/delete statements for all your <class> mappings and uses them. This setting you are using overwrites the default queries, but even in those cases Hibernate is the one that fills it up with data for you.
In this particular place you don't set the in/out parameters. Hibernate under the covers does this. Usually when Hibernate creates a SessionFactory and reads the config files it creates insert/update/delete statements for all your <class> mappings and uses them. This setting you are using overwrites the default queries, but even in those cases Hibernate is the one that fills it up with data for you.
Mark
But how does hibernate knows about my IN parameters? For example: I have delete stored proc. that takes the ID of the user who is attempting to deleted the record as an input parameter. We need this data for auditing purpose. i.e. { call delete_record(:recordId, :userId)
Samrat Gadamsetty
Greenhorn
Joined: Feb 10, 2011
Posts: 29
posted
0
Expecting someone will update the thread...
How <sql-update> will map with the parameters...
From my Example :
Please Correct my <sql-update> statement
update_SamratTest_1 will take two parameters empid and empsal..
Thanks in advance..
Samrat
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.