锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产51人人成人人人人爽色哟哟,亚洲欧美在线播放,在线观看91久久久久久http://www.aygfsteel.com/jdyao/category/8312.htmlzh-cnFri, 02 Mar 2007 06:48:07 GMTFri, 02 Mar 2007 06:48:07 GMT60琛ュ厖錛?Hibernate XDoclet 鍦‥clipse涓殑妯$増闅忕瑪)http://www.aygfsteel.com/jdyao/archive/2006/03/12/34911.html瑗塊儴鏉戦噷浜?/dc:creator>瑗塊儴鏉戦噷浜?/author>Sun, 12 Mar 2006 07:38:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/12/34911.htmlhttp://www.aygfsteel.com/jdyao/comments/34911.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/12/34911.html#Feedback0http://www.aygfsteel.com/jdyao/comments/commentRss/34911.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/34911.htmlHibernate XDoclet 鍦‥clipse涓殑妯$増
琛ュ厖錛?a id="CategoryEntryList1_EntryStoryList_Entries__ctl0_TitleUrl" href="../articles/34910.html">Hibernate瀵硅薄鍏寵仈--UML鍩虹鐭ヨ瘑銆乆Doclet---- 5 XDoclet Template In Eclipse
      (緋誨垪鍐呭鍙傜湅錛?a HREF="/jdyao/category/8354.html">嫻忚)


]]>
Hibernate XDoclet 鍦‥clipse涓殑妯$増http://www.aygfsteel.com/jdyao/archive/2006/03/10/34577.html瑗塊儴鏉戦噷浜?/dc:creator>瑗塊儴鏉戦噷浜?/author>Thu, 09 Mar 2006 16:28:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/10/34577.htmlhttp://www.aygfsteel.com/jdyao/comments/34577.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/10/34577.html#Feedback0http://www.aygfsteel.com/jdyao/comments/commentRss/34577.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/34577.html鏂規(guī)硶1錛?/b>
OO綾誨浘--銆夋暟鎹簱璁捐--銆塎iddleGen (鑳藉澶勭悊鍩烘湰鐨勫叧鑱斿叧緋?-鎵撳紑XDoclet鏍囩鐢熸垚寮鍏籌紝浣嗕笉鑳藉鐞嗙戶鎵挎蹇碉紝杈冧負閬楁喚ing)-->鍦‥clipse鎵嬪伐鏇存柊Java綾諱腑 鐨刋Doclet鏍囩錛岀劧鍚嶺Doclet鐢熸垚Hbm鏂囦歡銆傚綋鐒朵簡鍐嶅啓涓狫Unit嫻嬭瘯涓涓嬪叧鑱斿叧緋繪槸鍚︽紜紝蹇呰鐨凩azy鏄惁鏍囨敞銆?/font>

涓嬭澆Template錛?http://raibledesigns.com/wiki/Wiki.jsp?page=XDocletEclipse#hibcolidx 闈炲父鎰熻阿MattRaible.

鍦ㄤ腑鏂囩幆澧冧腑錛寃indow xp鐨勫瓧絎﹀垏鎹㈤敭涓嶦clipse妯$増鐨勫瓧絎﹀揩鎹烽敭閲嶅悎錛岄渶瑕佷慨鏀逛箣銆備負浜嗛伩鍏嶉夯鐑︼紝鐩存帴淇敼Template鏂囦歡錛岀畝鍗曟坊鍔燖鏍囩ず絎︼細鍏ㄦ枃濡備笅錛?br><?xml version="1.0" encoding="UTF-8"?>
<templates>
    <template name="@hibarray" description="@hibernate.array" context="javadoc" enabled="true">@hibernate.array table=&quot;&quot; cascade=&quot;save-update&quot;</template>
    <template name="@hibbag" description="@hibernate.bag" context="javadoc" enabled="true">@hibernate.bag table=&quot;&quot; lazy=&quot;false&quot; cascade=&quot;none&quot; inverse=&quot;false&quot;</template>
    <template name="@hibclass" description="@hibernate.class" context="javadoc" enabled="true">@hibernate.class table=&quot;${enclosing_type}&quot;</template>
    <template name="@hibcolelm" description="@hibernate.collection-element" context="javadoc" enabled="true">@hibernate.collection-element column=&quot;&quot; type=&quot;&quot; length=&quot;&quot;</template>
    <template name="@hibcolidx" description="@hibernate.collection-index" context="javadoc" enabled="true">@hibernate.collection-index column=&quot;&quot; type=&quot;&quot; length=&quot;&quot;</template>
    <template name="@hibcolkey" description="@hibernate.collection-key" context="javadoc" enabled="true">@hibernate.collection-key column=&quot;&quot; generator-class=&quot;native&quot;</template>
    <template name="@hibcolmtm" description="@hibernate.many-to-many" context="javadoc" enabled="true">@hibernate.set name=&quot;${enclosing_method}&quot; table=&quot;link_table_name_here&quot; cascade=&quot;save-update&quot; inverse=&quot;true|false&quot; lazy=&quot;true&quot;
     * @hibernate.collection-key column=&quot;${enclosing_type}_ID&quot;
     * @hibernate.collection-many-to-many class=&quot;relationship_class_the_set_contains&quot; column=&quot;relationship_foreign_key&quot;
     * @return ${return_type}</template>
    <template name="@hibcolotm" description="@hibernate.one-to-many relationship" context="javadoc" enabled="true">@hibernate.set name=&quot;${enclosing_method}&quot; table=&quot;relationship_table&quot;
     *                     sort=&quot;comparator_class&quot; inverse=&quot;true|false&quot;
     *                     cascade=&quot;save-update&quot; lazy=&quot;true&quot;
     * @hibernate.collection-key column=&quot;${enclosing_type}_ID&quot;
     * @hibernate.collection-one-to-many class=&quot;relationship_class&quot;
     *
     * @return ${return_type}</template>
    <template name="@hibcomelm" description="@hibernate.collection-composite-element" context="javadoc" enabled="true">@hibernate.collection-composite-element class=&quot;&quot;</template>
    <template name="@hibcomp" description="@hibernate.component" context="javadoc" enabled="true">@hibernate.component class=&quot;component_class_name&quot;</template>
    <template name="@hibdisc" description="@hibernate.discriminator" context="javadoc" enabled="true">@hibernate.discriminator column=&quot;subclass&quot; type=&quot;character&quot;</template>
    <template name="@hibid" description="@hibernate.id" context="javadoc" enabled="true">Note: unsaved-value An identifier property value that indicates that an instance
     * is newly instantiated (unsaved), distinguishing it from transient instances that
     * were saved or loaded in a previous session.  If not specified you will get an exception like this:
     * another object associated with the session has the same identifier
     *
     * @hibernate.id generator-class=&quot;&quot; type=&quot;${return_type}&quot; column=&quot;${enclosing_type}_ID&quot;
     * unsaved-value=&quot;null&quot; length=&quot;&quot;
     * @return ${return_type}</template>
    <template name="@hiblist" description="@hibernate.list" context="javadoc" enabled="true">@hibernate.list table=&quot;relationship-table&quot; lazy=&quot;false&quot; cascade=&quot;none&quot;</template>
    <template name="@hibmap" description="@hibernate.map" context="javadoc" enabled="true">@hibernate.map name=&quot;${enclosing_method}&quot; table=&quot;relationship-table&quot; lazy=&quot;false&quot; cascade=&quot;none&quot;</template>
    <template name="@hibmto" description="@hibernate.many-to-one" context="javadoc" enabled="true">@hibernate.many-to-one column=&quot;${return_type}_ID&quot; class=&quot;package.${return_type}&quot;
     *
     * @return ${return_type}
     *</template>
    <template name="@hiboto" description="@hibernate.one-to-one" context="javadoc" enabled="true">hibernate.one-to-one cascade=&quot;none&quot; class=&quot;&quot; outer-join=&quot;auto&quot;</template>
    <template name="@hibprimarr" description="@hibernate.primitive-array" context="javadoc" enabled="true">@hibernate.primitive-array table=&quot;&quot; cascade=&quot;none&quot;</template>
    <template name="@hibprop" description="@hibernate.property" context="javadoc" enabled="true">@hibernate.property name=&quot;${enclosing_method}&quot; column=&quot;${enclosing_method}&quot; type=&quot;${return_type}&quot; not-null=&quot;false&quot; unique=&quot;false&quot;
     *
     * @return ${return_type}</template>
    <template name="@hibquery" description="@hibernate.query" context="javadoc" enabled="true">@hibernate.query name=&quot;&quot; query=&quot;&quot;</template>
    <template name="@hibset" description="@hibernate.set" context="javadoc" enabled="true">@hibernate.set name=&quot;${enclosing_method}&quot; table=&quot;relationship_table&quot;
     *                     sort=&quot;comparator_class&quot; inverse=&quot;true&quot;
     *                     cascade=&quot;save-update&quot; lazy=&quot;true&quot;</template>
    <template name="@hibsubc" description="@hibernate.subclass" context="javadoc" enabled="true">@hibernate.subclass name=&quot;&quot; discriminator-value=&quot;&quot;</template>
    <template name="@hibts" description="@hibernate.timestamp" context="javadoc" enabled="true">@hibernate.timestamp column=&quot;${enclosing_method}&quot;
     *
     * @return ${return_type}</template>
    <template name="@hibver" description="@hibernate.version" context="javadoc" enabled="true">@hibernate.version column=&quot;${enclosing_method}&quot;
     *
     * @return ${return_type}</template>
</templates>

浣跨敤鏃訛細鍏堟妸XML鍐呭鍗曠嫭淇濆瓨涓烘枃浠訛紝鐒跺悗鍦‥clipse-->Windows-->Preferences
                                     鍦≒references-->Java-->Editor-->Templates 鐐瑰嚮Import鎸夐挳瀵煎叆涔嬪墠宸茬粡淇濆瓨鐨刋ML鏂囦歡銆?br>
鏂規(guī)硶2錛?br>
OO綾誨浘--銆夊湪Eclipse鎵嬪伐緙栧啓灞炴?-銆夌敓鎴怗et/Set鏂規(guī)硶--銆夋洿鏂癑ava綾諱腑 鐨刋Doclet鏍囩錛岀劧鍚嶺Doclet鐢熸垚Hbm鏂囦歡銆傚綋鐒朵簡鍐嶅啓涓狫Unit嫻嬭瘯涓涓嬪叧鑱斿叧緋繪槸鍚︽紜紝蹇呰鐨凩azy鏄惁鏍囨敞銆?br>瑕佹眰鍏堜慨鏀笹et鏂規(guī)硶鐨勬ā鏉匡細婧愪唬鐮佺紪杈戝櫒涓紶鏍囧彸閿?-銆塖ource--銆塆enerate Getters And Setters..
bb.PNG
                      
               鐐瑰嚮鎵撳紑闈㈡澘涓瑿ode Template閾炬帴銆?br>aa1.PNG

緙栬緫Getter鏂規(guī)硶妯℃澘錛?br>/**
 * @hibernate.property name="${bare_field_name}" column="${field}" type="${field_type}" not-null="false" unique="false" length="128"
 * @return Returns the ${bare_field_name}.
 */
鐒跺悗鐢熸垚浠g爜錛屾墜宸ュ井璋冮儴鍒嗗睘鎬с備篃鑳藉鑺傜害澶ч噺鏃墮棿銆?br>
娉ㄦ剰錛氬湪緙栧啓Java POJO綾繪椂錛宩ava灞炴х敤瀹屾暣鐨勫甫鍖呭悕鐨勭被錛屼緥濡傦細
/**
* @author jdyao
 * @hibernate.class table="respri"
 * @version
 */
public class Resource implements Serializable {

    private static final long serialVersionUID = 1505581058179605003L;

    private java.lang.String guid;

    private java.lang.String context;

 

    public
Resource () {

    }

    /**
     * @return java.lang.String
     * @hibernate.property name="context" type="java.lang.String"
     *                     length="128"
     *
     */
    public java.lang.String getContext() {
        return context;
    }

    public void setContext(java.lang.String context) {
        this.context = context;
    }

    /**
     * @return java.lang.String
     * @hibernate.id generator-class="guid" type="java.lang.String" column="guid"
     *               unsaved-value="null" length="38"
     */
    public java.lang.String getGuid() {
        return guid;
    }

    public void setGuid(java.lang.String guid) {
        this.guid = guid;
    }

}
鍘熷洜錛歑Doclet鍦ㄧ敓鎴愮殑鏃跺欙紝濡傛灉type="string",鏈夋椂浼氬嚭鐜伴敊璇紝鏃犳硶鐢熸垚Hbm鏂囦歡錛屼負浜嗛伩鍏嶈繖涓笉蹇呰鐨勯敊璇紝鍔″繀瑕佸啓鍏ㄧ被鍚嶃?br>
XDoclet build.xml鏂囦歡錛?/b>

<?xml version="1.0" encoding="ISO-8859-1"?>

<project name="XDoclet Examples" default="hibernate" basedir=".">
    <property name="xdoclet.root.dir" value="${basedir}"/>
    <property file="${xdoclet.root.dir}/build.properties"/>

    <!-- Include the build-dist properties. Since properties are immutable,
    this will not override available properties. You do not have to include
    this in your own build file. -->
    <property file="build-dist.properties"/>

    <!-- See CustomerBean. This is to demonstrate property substitution. -->
    <property name="ejb.prefix" value="blah"/>

    <!-- =================================================================== -->
    <!-- Define the class path                                               -->
    <!-- =================================================================== -->
    <path id="samples.class.path">
        <fileset dir="${lib.dir}">
            <include name="*.jar"/>
        </fileset>
        <fileset dir="${samples.lib.dir}">
            <include name="*.jar"/>
        </fileset>
        <fileset dir="${dist.lib.dir}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <!-- =================================================================== -->
    <!-- Initialise                                                          -->
    <!-- =================================================================== -->
    <target name="init">
        <tstamp>
            <format property="TODAY" pattern="d-MM-yy"/>
        </tstamp>
        <taskdef
            name="xdoclet"
            classname="xdoclet.DocletTask"
            classpathref="samples.class.path"
            />
         <taskdef
            name="hibernatedoclet"
            classname="xdoclet.modules.hibernate.HibernateDocletTask"
            classpathref="samples.class.path"
            />
    </target>


    <!-- =================================================================== -->
    <!-- Prepares the directory structure                                    -->
    <!-- =================================================================== -->
    <target name="prepare" depends="init">
        <mkdir dir="${samples.classes.dir}"/>
        <mkdir dir="${samples.gen-src.dir}"/>
        <mkdir dir="${samples.meta-inf.dir}"/>
    </target>



    <!-- =================================================================== -->
    <!-- Invoke XDoclet's hibernate                                          -->
    <!-- =================================================================== -->
    <target name="hibernate" depends="prepare" description="Generate mapping documents (run jar first)">

        <echo>+---------------------------------------------------+</echo>
        <echo>|                                                   |</echo>
        <echo>| R U N N I N G   H I B E R N A T E D O C L E T     |</echo>
        <echo>|                                                   |</echo>
        <echo>+---------------------------------------------------+</echo>

        <hibernatedoclet
            destdir="${samples.gen-src.dir}"
            mergedir="${samples.src.dir}"
            excludedtags="@version,@author,@todo,@see"
            addedtags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}"
            force="${samples.xdoclet.force}"
            verbose="false">

            <fileset dir="${samples.java.dir}">
                <include name="**/**/*.java"/>
            </fileset>

            <hibernate version="3.0"/>

        </hibernatedoclet>
    </target>

    <!-- =================================================================== -->
    <!-- Clean                                                               -->
    <!-- =================================================================== -->
    <target name="clean">
        <delete dir="${samples.dist.dir}"/>
    </target>

</project>
build-dist.properties 鏂囦歡錛?br># These properties are only used when building the samples expanded from the distribution.

lib.dir = ${xdoclet.root.dir}/lib
dist.lib.dir = ${lib.dir}

samples.dir = ${xdoclet.root.dir}
samples.dist.dir = ${samples.dir}/target
samples.lib.dir = ${samples.dir}/lib
samples.src.dir = ${samples.dir}/src
samples.java.dir = ${samples.src.dir}/java
samples.gen-src.dir = ${samples.dist.dir}/gen-src

samples.meta-inf.dir = ${samples.dist.dir}/meta-inf
samples.web-inf.dir = ${samples.dist.dir}/web-inf
samples.merge.dir = ${samples.src.dir}/merge
samples.classes.dir = ${samples.dist.dir}/classes
samples.web.dir = ${samples.src.dir}/web
samples.xdoclet.force = false

宸ョ▼鐩綍緇撴瀯錛?a >浠嶺Doclet緗戠珯涓嬭澆璇ュ寘錛岃В鍘嬬緝鍚庯紝鎶奅xample鐩綍鍗曠嫭copy鍑烘潵錛屾妸榪?涓枃浠舵斁鍦‥xample鐩綍涓嬶紝鍚屾椂寤虹珛lib鐩綍錛屾妸XDoclet鐩綍涓?-銆塴ib鐩綍涓嬬殑*.jar鎷瘋礉鍒癊xample鏂板緩绔嬬殑lib鐩綍涓嬨?/font>


]]>
主站蜘蛛池模板: 门源| 临泽县| 察隅县| 镇安县| 延庆县| 佛学| 乐东| 格尔木市| 龙江县| 商洛市| 宕昌县| 宁河县| 扬中市| 黔南| 娄烦县| 固阳县| 廉江市| 榆树市| 临澧县| 汝州市| 平远县| 岑溪市| 恩施市| 昭平县| 牙克石市| 高州市| 东阿县| 北安市| 五常市| 大化| 陆良县| 大丰市| 油尖旺区| 靖安县| 仁寿县| 淮安市| 资兴市| 海南省| 酒泉市| 娄烦县| 乐陵市|