Message:

   The following issue has been re-assigned.

   Assignee: Paul Galbraith (mailto:[EMAIL PROTECTED])
---------------------------------------------------------------------
View the issue:
  http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1312

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-1312
    Summary: Add @hibernate.meta, improve @hibernate.many-to-one, create 
hibernate-queries-{0}.xml and improve @hibernate.component
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: XDoclet
 Components: 
             Hibernate Module
   Versions:
             1.3

   Assignee: Paul Galbraith
   Reporter: Allan Jones

    Created: Thu, 24 Mar 2005 9:39 AM
    Updated: Thu, 24 Mar 2005 11:10 AM

Description:
======================================================================
@hibernate.meta

+ <XDtClass:forAllClassTags tagName="hibernate.meta" superclasses="false">
+  <meta
+    attribute="<XDtClass:classTagValue tagName="hibernate.meta" 
paramName="attribute" />"
+  ><XDtClass:classTagValue tagName="hibernate.meta" paramName="value" /></meta>
+ </XDtClass:forAllClassTags>

So, you can specify meta attributes for classes, example:

/**
 * @hibernate.class
 * @hibernate.meta attribute="storedProcedureName" value="MY_STORED_PROCEDURE"
 */
public class MyHibernateClass {
}

<class name="MyHibernateClass">
  <meta
    attribute="storedProcedureName"
  >MY_STORED_PROCEDURE</meta>
</class>

======================================================================
@hibernate.many-to-one

<key-many-to-one
  name="<XDtMethod:propertyName/>"
  class="<XDtMethod:methodTagValue tagName="hibernate.many-to-one" 
paramName="class" default="<XDtMethod:methodType/>" />"
- column="<XDtMethod:methodTagValue tagName="hibernate.many-to-one" 
paramName="column" default="<XDtMethod:propertyName/>"/>"
- />
+ <XDtHibernate:setCurrentTag name="hibernate.many-to-one" 
mappingElement="key-many-to-one">
+   <XDtMerge:merge 
file="xdoclet/modules/hibernate/resources/hibernate-column.xdt">
+   </XDtMerge:merge>
+ </XDtHibernate:setCurrentTag>

So, you can specity multiple columns, example:

public class MyHibernateClass {
   /**
    * @hibernate.many-to-one
    * @hibernate.column name="COL_1"
    * @hibernate.column name="COL_2"
    * @hibernate.column name="COL_3"
    */
   public OtherClass getOtherClass() {
      return otherClass;
   }

}

<many-to-one
  name="otherClass"
  class="OtherClass"
  cascade="none"
  outer-join="auto">
  <column name="COL_1" />
  <column name="COL_2" />
  <column name="COL_3" />
</many-to-one>
======================================================================

hibernate-queries-{0}.xml

+    <XDtMerge:merge file="hibernate-queries-{0}.xml">
+        <!--
+            To add non XDoclet query mappings, create a file named
+                hibernate-queries-<XDtClass:className />.xml
+            containing the additional properties and place it in your merge 
dir.
+        -->
+    </XDtMerge:merge>


So, you can define a merge file for queries, example:

/**
 * @hibernate.class
 */
public class MyHibernateClass {
}

hibernate-queries-MyHibernateClass.xml
<sql-query name="MyHibernateClass.mySQLQuery">
  <![CDATA[
    SELECT * FROM MYTABLE
  ]]>
</sql-query>
======================================================================

@hibernate.component -> Added hibernate-properties-{0}.xml:

<XDtMethod:ifHasMethodTag tagName="hibernate.component">
  <component
      name="<XDtMethod:propertyName />"
      class="<XDtMethod:methodTagValue tagName="hibernate.component" 
paramName="class" default="<XDtMethod:methodType/>"/>"
  >
    <XDtHibernate:setColumnPrefix
      prefix="<XDtMethod:methodTagValue
      tagName='hibernate.component'
      paramName='prefix' default=''/>">
      <XDtClass:pushClass value="<XDtMethod:methodTagValue 
tagName='hibernate.component' paramName='class' 
default='<XDtMethod:methodType/>' />">
          <XDtMethod:forAllMethods superclasses="true" sort="true">
              <XDtMerge:merge 
file="xdoclet/modules/hibernate/resources/hibernate-properties.xdt">
              </XDtMerge:merge>
          </XDtMethod:forAllMethods>
+          <XDtMerge:merge file="hibernate-properties-{0}.xml">
+              <!--
+                  To add non XDoclet property mappings, create a file named
+                      hibernate-properties-<XDtClass:className />.xml
+                  containing the additional properties and place it in your 
merge dir.
+              -->
+          </XDtMerge:merge>
      </XDtClass:pushClass>
    </XDtHibernate:setColumnPrefix>
  </component>
</XDtMethod:ifHasMethodTag>

So you can use abstract components with many concrete impls and different 
mapping properties, example:

public class MyHibernateClass {
   ...
   /**
     * @hibernate.component
     */
    public MyConcreteComponent getMyConcreteComponent() {
       return myConcreteComponent;
    }
    
   /**
     * @hibernate.component
     */
    public MyConcreteComponent2 getMyConcreteComponent2() {
       return myConcreteComponent2;
    }
}

public abstract class MyAbstractComponent {
   public String getSomeCommonProperty() {
      return someCommonProperty;
   }
}

public class MyConcreteComponent extends MyAbstractComponent {
}


public class MyConcreteComponent2 extends MyAbstractComponent {
}

hibernate-properties-MyConcreteComponent.xml
<property
  name="someCommonProperty"
  type="java.lang.String"
  column="COLUMN_1" />

hibernate-properties-MyConcreteComponent2.xml
<property
  name="someCommonProperty"
  type="java.lang.String"
  column="OTHER_COLUMN" />
----------------------------------------------------------------------


---------------------------------------------------------------------
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