Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: HibernateException: Errors in named queries
PostPosted: Tue Dec 29, 2009 12:22 pm 
Newbie

Joined: Thu Oct 22, 2009 12:37 pm
Posts: 3
Using Struts 1.3 , Hibernate 3 and Tomcat 5.5v

I have a stored procedure that gives values from multiple tables.

Java Class to get the data -->
List list = null;
try
{
Session session = HibernateUtils.currentSession();
Query query = session.getNamedQuery("SalesForecastSalesRepSummarySp");
query.setParameter("para1", marketID );
query.setParameter("para2", statusID );
query.setParameter("para3",quarterID);
query.setParameter("para4", month );
query.setParameter("para5",year );
query.setParameter("para6",customer );
query.setParameter("para7",loggedInUserID);

list = query.list();

HibernateUtils.closeSession();

}
catch (Exception e) {
System.out.println(e);
}
return list;



POJO (SalesForecast.java)
______________________

public class SalesForecast implements java.io.Serializable{

private Short managerId;
private Short saleaRepId;
private Short totalPrice;
private BigDecimal forecast;
private BigDecimal pending;
private BigDecimal booked;
private BigDecimal lost;

public SalesForecast()
{
super();
}
public SalesForecast(Short managerId
, Short saleaRepId
, Short totalPrice
, BigDecimal forecast
, BigDecimal pending
, BigDecimal booked
,BigDecimal lost)
{
super();
this.managerId = managerId;
this.saleaRepId = saleaRepId;
this.totalPrice = totalPrice;
this.forecast = forecast;
this.pending = pending;
this.booked = booked;
this.lost=lost;
}

public Short getManagerId() {
return managerId;
}
public void setManagerId(Short managerId) {
this.managerId = managerId;
}


public Short getSaleaRepId() {
return saleaRepId;
}

public void setSaleaRepId(Short saleaRepId) {
this.saleaRepId = saleaRepId;
}



public Short getTotalPrice() {
return totalPrice;
}

public void setTotalPrice(Short totalPrice) {
this.totalPrice = totalPrice;
}

public BigDecimal getForecast() {
return forecast;
}
public void setForecast(BigDecimal forecast) {
this.forecast = forecast;
}
public BigDecimal getPending() {
return pending;
}
public void setPending(BigDecimal pending) {
this.pending = pending;
}
public BigDecimal getBooked() {
return booked;
}
public void setBooked(BigDecimal booked) {
this.booked = booked;
}

public BigDecimal getLost() {
return lost;
}

public void setLost(BigDecimal lost) {
this.lost = lost;
}

}



SalesForecast.hbm.xml
___________________
<hibernate-mapping>

<sql-query name="dbo.SalesForecastSalesRepSummarySp" callable="true">
<return alias="SalesForecastSalesRepSummarySp" class="com.cynosure.sf.domain.SalesForecast">
<return-property name="managerId" column="ManagerId"/>
<return-property name="saleaRepId" column="SaleaRepId"/>
<return-property name="totalPrice" column="TotalPrice"/>
<return-property name="forecast" column="Forecast"/>
<return-property name="pending" column="Pending"/>
<return-property name="booked" column="Booked"/>
<return-property name="lost" column="Lost"/>

</return>
{ ? = call SalesForecastSalesRepSummarySp(:para1, :para2, :para3, :para4, :para5, :para6, :para7) }

</sql-query>
</hibernate-mapping>

ERRORS-->

javax.servlet.ServletException: Filter execution threw an exception


root cause

java.lang.ExceptionInInitializerError
com.cynosure.sf.utils.HibernateUtils.<clinit>(HibernateUtils.java:22)
com.cynosure.sf.service.impl.SecurityServiceImpl.authenticateUser(SecurityServiceImpl.java:28)
com.cynosure.sf.security.SecurityFilterRealm.booleanAuthenticate(SecurityFilterRealm.java:14)
org.securityfilter.realm.SimpleSecurityRealmBase.authenticate(SimpleSecurityRealmBase.java:107)
org.securityfilter.authenticator.FormAuthenticator.processLogin(FormAuthenticator.java:178)
org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:138)


root cause

org.hibernate.HibernateException: Errors in named queries: dbo.SalesForecastSalesRepSummarySp
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:407)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
com.cynosure.sf.utils.HibernateUtils.<clinit>(HibernateUtils.java:18)
com.cynosure.sf.service.impl.SecurityServiceImpl.authenticateUser(SecurityServiceImpl.java:28)
com.cynosure.sf.security.SecurityFilterRealm.booleanAuthenticate(SecurityFilterRealm.java:14)
org.securityfilter.realm.SimpleSecurityRealmBase.authenticate(SimpleSecurityRealmBase.java:107)
org.securityfilter.authenticator.FormAuthenticator.processLogin(FormAuthenticator.java:178)
org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:138)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.


I have been trying to resolve it for a while. But cannot find way out. Any help will be appreciated. Thanks in Advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.