-->
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: HibernateSystemException: Named query not known
PostPosted: Sun Oct 30, 2011 8:57 am 
Newbie

Joined: Fri Oct 28, 2011 11:27 pm
Posts: 1
I am new to Hibernate and am trying to execute a database function/stored procedure and am getting a HibernateSystemException (Named query not known). From the postings that I have read, it seems that the steps are all completed but this is definitely not working.

I'm running it on an Oracle 9i with JDK 6.

How I've configured hibernate and Spring:

1. Set up a META-INF/hbm.xml file:
Code:
<?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="getdetails_FN"
      callable="true">
      <return class="com.mycompany.Company" />
      { call get_company_details_FN (?, :companyId) }
   </sql-query>
</hibernate-mapping>


Code:
   public String getCompanyDetails(String companyId) {
      
      Company company = null;
      List companyDetailsList;
      
      try{
         companyDetailsList = sessionFactory.getCurrentSession().getNamedQuery("getdetails_FN").setParameter("companyId", companyId).list();
         
         company = systemTraceNumberList.get(0);
      }
      catch (Exception e){
      }
      
      return company;
   }


Now, I'm not sure how Hibernate/Spring reads this hbm.xml file so that the session has a named query, but I am wondering whether that is the issue. Has anyone been able to get this to work?

Thank you.


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.