-->
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.  [ 3 posts ] 
Author Message
 Post subject: hbm2dao and named queries
PostPosted: Tue Jan 03, 2006 4:35 am 
Newbie

Joined: Tue Jan 03, 2006 4:24 am
Posts: 4
When generating Daos with hbm2dao from Hibernate Tools 3.1beta2 there are no parameters to the methods created from the named queries.

I believe that hbm2dao performs this call to obtain the named queries
Code:
Map m<String, NamedQuerydefinition> = new Configuration().getNamedQueries();

and calls this to obtain the typed parameters
Code:
m.get("foo.Template.findById").getParameterTypes()

Logging at debug-level shows that hibernate doesn't parse the named queries before
Code:
cfg.buildSessionFactory()
is called, and even then the call to
Code:
getNamedQueries()
returns queries with typed parameters. I've checked using a debugger that the variable namedQueries in the Configuration object never contains the typed parameters as far as I can see.

I'm really hoping to generate a dao using this tool!

Thanks in advance!

Hibernate version:
3.1
Mapping documents:
<hibernate-mapping>
...
<query name="foo.Template.findById"><![CDATA[
from Template t
inner join fetch t.components
where t.id = :id
]]>
</query>
</hibernate-mapping>

Name and version of the database you are using:
MSSQL 2000


Top
 Profile  
 
 Post subject: Oops, sorry
PostPosted: Tue Jan 03, 2006 4:37 am 
Newbie

Joined: Tue Jan 03, 2006 4:24 am
Posts: 4
...
is called, and even then the call to
Code:
getNamedQueries()

returns queries WITHOUT typed parameters
...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 5:09 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to specify <query-param> for <query> & <sql-query> if you want this to work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.