-->
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: NullPointerException, calling StoredProcedure from Hibernate
PostPosted: Tue Aug 05, 2008 6:17 am 
Newbie

Joined: Tue Aug 05, 2008 6:04 am
Posts: 1
Hi All,

I got NullPointerException when I call sql server storedprocedure from hibernate mapping. I am sending my code, plz do provide a solution to my problem

//mapping code

<sql-query name="selectAllEmployees_SP" callable="true">
<return alias="Employee" class="Employee">
<return-property name="empId" column="EmpId"/>
<return-property name="empName" column="EmpName"/>
<return-property name="empSal" column="EmpSal"/>
<return-property name="empAdd" column="EmpAdd"/>
<return-property name="id" column="id"/>

</return>
{call selectAllEmployees()}
</sql-query>

//end of mapping code

The following is the mapping for Employee class

<class name="Employee" table="Employee">
<id name="id" type="int">
</id>
<property name="empId">
<column name="EmpId" />
</property>
<property name="empName">
<column name="EmpName"/>
</property>
<property name="empSal">
<column name="EmpSal"/>
</property>
<property name="empAdd">
<column name="EmpAdd"/>
</property>
</class>

calling from my program:

trans=session.beginTransaction();
System.out.println("before calling procedure");
List offerq=session.getNamedQuery("selectAllEmployees_SP").list();
Iterator offerit=offerq.iterator();
while(offerit.hasNext())
{
Employee o=(Employee)offerit.next();
System.out.println("emp name from procedure=="+o.getEmpName()); //exception in this line
}
trans.commit();
session.close();


Do I miss anything in this code?


Thanx in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 24, 2008 2:52 pm 
Newbie

Joined: Thu Jun 26, 2008 5:13 pm
Posts: 5
I to have sane problem.I like to know how your problem was solved.


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.