Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting HibernateException: Errors in named queries

 
D Sheth
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all:

I am working on a Struts 1.2.9/Hibernate 3.1.3 Application on Weblogic 8.1.5. I am trying to use Named Queries, but running into an exception mentioned above.

Code is:


This, when executed throws following exception:


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

[ June 30, 2006: Message edited by: D Sheth ]

[ June 30, 2006: Message edited by: D Sheth ]

[ June 30, 2006: Message edited by: D Sheth ]
[ June 30, 2006: Message edited by: D Sheth ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tough to figure out. But I have a couple of questions.

1. Are you trying to pass parameter to the query, because the named query that you have does not take parameters.

2. Your "dao" object isn't a dao, it is a DTO at the current state or if you add behavior then it could become a BO or Business Object.

3. Whereas in your HibernateUtil you call to run a query which is a method you would find in a "dao" Data Access Object.

Thanks

Mark
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any other (chained) exception being logged that might have more details?

I would try two things:

1. Fully qualify the class name in the query ("com.test.hibernate.dao.SystemDAO").

2. Turn up logging for org.hibernate.* and see if that provides more details.
 
a ramazany
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also add class tag to your hbm file

<hibernate-mapping>
<class name="aip.law.orm.hntest.SpHntest">
<id name="id" type="java.lang.Integer">
<column name="ID" />
</id>
<property name="caption" type="java.lang.String">
<column name="Caption" length="60" not-null="true" />
</property>
<loader query-ref="testingProc" />
</class>
<sql-query name="testingProc" callable="true" >
<return alias="SpHntest" class="aip.law.orm.hntest.SpHntest">
<return-property name="id" column="ID"/>
<return-property name="caption" column="Caption"/>
</return>
{call sphntest()}

</sql-query>
</hibernate-mapping>
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"a ramazany",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"D Sheth",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
 
Maruti Nori
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow the below link:

http://www.hibernate.org/250.html#A25
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic