The following issue has been updated:

    Updater: Peilin Zhang (mailto:[EMAIL PROTECTED])
       Date: Mon, 11 Apr 2005 4:23 PM
    Comment:
I have attached my fix to XDT-1061 for your review.
 Problem description:
 ==============
 The @hibernate.query tag is currently coupled with @hibernate.class tag, 
 making it impossible to generate hibernate mapping files that contains 
 only named query definitions. This requirement is essential for large 
 projects where named queries are defined with the Data Access Objects.
 Fix for the problem:
 =============
 To fix the problem, two issues have to be addressed:
 1. In XDoclet core, a TemplateSubTask has to support the ability to use 
 multiple "havingClassTag" values (a String array of tag names). In the 
 case of Hibernate module, both "hibernate.class" and "hibernate.query" 
 should qualify for XDoclet generation.
 2. In XDoclet Hibernate module, the hibernate.xdt template file has to 
 be changed so that the "hibernate.class" tag is no longer a requirement 
 for the "hibernate.query" tag to be processed.
 
 The attached patch file contains fixes to the above problems.
 
 Regards.
    Changes:
             Attachment changed to patch.diff
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1061?page=history

---------------------------------------------------------------------
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: Mon, 11 Apr 2005 4:23 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

Reply via email to