-->
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.  [ 1 post ] 
Author Message
 Post subject: execute store procedure using hibernate
PostPosted: Mon Apr 12, 2010 12:15 pm 
Newbie

Joined: Thu Sep 24, 2009 11:49 am
Posts: 8
im getting an error while executing store procedure using hibernate and the error is as below;

org.hibernate.HibernateException: Errors in named queries: CHECKUSERID1


----------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<sql-query name="CHECKUSERID1" callable="true">
<return alias="CHECKUSERID1" class="component.CheckUser">
<return-property name="IC_USER_TYPE" column="IC_USER_TYPE"/>
</return>
{ ? = call CHECKUSERID1() }
</sql-query>
</hibernate-mapping>


-----------------------------------------------------------------------------------------------------

package component;


public class CheckUser implements java.io.Serializable {

private String IC_USER_TYPE="";

public CheckUser()
{

}

public String getIC_USER_TYPE () {
return this.IC_USER_TYPE ;
}

public void setIC_USER_TYPE (String IC_USER_TYPE ) {
this.IC_USER_TYPE = IC_USER_TYPE ;
}

}



-----------------------------------------------------------------------------------------------------

package component;


import org.hibernate.*;
import org.hibernate.cfg.*;
import java.util.List;

public class ProcedureCall
{
public static void main(String args[])
{
Session session = null;
SessionFactory factory = null;
Transaction t = null;

try
{
factory = new Configuration().configure().buildSessionFactory();
session = factory.openSession();
Query query = session.getNamedQuery("CHECKUSERID1");
List results = query.list();
session.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}

--------------------------------------------------------------------------

CREATE OR REPLACE PROCEDURE CHECKUSERID1
(

ref_cursor OUT SYS_REFCURSOR
)
AS
BEGIN
OPEN ref_cursor FOR

SELECT IC_USER_TYPE from USER_PROFILE_TABLE
where trim(USER_ID)='SUBHASISH';

END CHECKUSERID1;
/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.