The following comment has been added to this issue: Author: peilinz Created: Thu, 7 Apr 2005 2:59 PM Body: I agree with the original post. But I also believe it is not necessary to put the attribute at the method level. There is no association between the method and the query after all, because one can use the query at many places. Putting the query definition in the Hibernate POJO class is a solution but not very intuitive and desirable. I'm not new to XDoclet but I don't have much knowledge editing XDT files (if that's what it takes for this to work). Hopefully someone will come along and fix this for us. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1061?page=comments#action_16295
--------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1061 Here is an overview of the issue: --------------------------------------------------------------------- Key: XDT-1061 Summary: Improving hibernate.query processing Type: Improvement Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: XDoclet Components: Hibernate Module Versions: 1.2.2 Assignee: xdoclet-devel (Use for new issues) Reporter: Xdoclet User Created: Wed, 8 Sep 2004 6:32 PM Updated: Thu, 7 Apr 2005 2:59 PM Environment: All Description: If I understand correctly the hibernate.query tag is currently positioned at the Class level rather than at the Method level. It would be great if this tag supports both. Here is the reason. Let have a look at the Hibernate's "Cat" example. Within the class Cat, we define the usual Hibernate.class and hibernate.property, hibernate.one-to-many and hibernate.many-to-one etc. And this is great. If we then employ the DAO pattern to define the CRUD (Create, Retrieve, Update, Delete) operations for the Cat to abstract away the underlying implementations then it makes sense to define "Named Query" in there. At the moment it is not possible. My "workaround" at the moment is to define a number of CRUD related "Named Query" inside the class Cat. This "workaround" works fine but it is a bit ugly, actually very ugly in my view. So, I'd like to request for 2 improvements: 1. Support for hibernate.query at method level. For example: public interface CatDAO { public Serializable create(Cat cat) throws ...; public void delete(Cat cat) throws ...; public void update(Cat cat) throws ...; public Cat retrieveById(Long id) throws ...; public Collection retrieveAll() throws ...; /** * @hibernate.query name="CatDAO.findByMate" * query="blah blah blah ..." */ public Collection findByMate(Long mateId) throws ...; /** * @hibernate.query name="CatDAO.findByChild" * query="blah blah blah ..." */ public Collection findByChild(Long childId) throws ...; ..... etc etc } 2. Since the above "CatDAO" is an interface and is in another class (all other mapping for Cat is in the Cat class) there has to be a mechanism for defining which file (Cat.hbm.xml in this case) the generated "Named Query" should be merged with. I am new to Xdoclet and still learning to understand how it works, especially the Template. I hope someone will address this quickly. In the mean time, I will try to play around with the Hibernate module. If I get it to work I'll keep everyone posted. The chance of this is very slim because as I said I am still learning Xdoclet. Cheers --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel