From: Christian B. (JIRA) <no...@at...> - 2006-05-19 07:19:16
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1757?page=comments#action_23131 ] Christian Bauer commented on HHH-1757: -------------------------------------- Documented this... > "Named query not known" with valid <query>. Invalid hibernate-mapping-3.0.dtd > ------------------------------------------------------------------------------ > > Key: HHH-1757 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1757 > Project: Hibernate3 > Type: Bug > Versions: 3.1.3 > Environment: Hibernate v3.1.3, MySQL v5.0.21, jdk1.5.0_06 > Reporter: W. Muir > Priority: Minor > > > <query> element in a hibernate mapping file validates against the DTD (http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd) for both cases: > Case 1: <query> element outside <class> > <hibernate-mapping> > <class name="com.acme.Foo" table="foo"> > ... > </class> > <query name="Foo.findBy"> > <![CDATA[ FROM Foo WHERE ... ]]> > </query> > </hibernate-mapping> > Case 2: <query> element inside <class> > <hibernate-mapping> > <class name="com.acme.Foo" table="foo"> > ... > <query name="Foo.findBy"> > <![CDATA[ FROM Foo WHERE ... ]]> > </query> > </class> > </hibernate-mapping> > However, Case 2 produces a Mapping Exception: > > org.hibernate.MappingException: Named query not known: Foo.findBy > when session.getNamedQuery( "Foo.findBy" ) is called. > If the the exception caused by Case #2 is legit, then the DTD should be changed so mapping xml will not validate when <query> is within <class> element. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |