Re: Hibernate noob problem - Named query not known
From: Alan (nomorezpam3_at_hotmail.com)
Date: 08/20/04
- Next message: Joe Weinstein: "Re: Question understanding Connection/Statement"
- Previous message: Laura P: "Geometery access via JDBC"
- In reply to: Alan: "Hibernate noob problem - Named query not known"
- Next in thread: Alan: "Re: Hibernate noob problem - Named query not known"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Aug 2004 06:46:39 -0700
Think I found the solution, looking at the Hibernate private forums on
http://forum.hibernate.org/viewforum.php?f=1 ... Named Queries are
declared in the .hbm file with the format...
<query name="country.by_code">
<![CDATA[
from com.test.hibernate.mapping.Country where country_cd =
:country_cd]]>
</query>
I then call
try {
Query query = session.getNamedQuery("country.by_code");
query.setString("country_cd", code);
return (Country)query.list().get(0);
}
finally {
session.close();
}
Thanks anyway
- Next message: Joe Weinstein: "Re: Question understanding Connection/Statement"
- Previous message: Laura P: "Geometery access via JDBC"
- In reply to: Alan: "Hibernate noob problem - Named query not known"
- Next in thread: Alan: "Re: Hibernate noob problem - Named query not known"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]