在IntelliJ Idea中集成 Hibernate Xdoclet 开发

 在IntelliJ Idea中集成 Hibernate Xdoclet 开发 

   在hibernate开发中,我们经常使用Xdoclet标签,这样一来可以省去配置的功夫,二来看起来更容易理解,如果在IDE工具中集成了Xdoclet的提示则大大提高xdoclet标签的使用正确性和开发效率。

  在ItelliJ Idea 6中集成Hibernate Xdoclet,步骤如下:

 1.下载hibernate.xml文件到 %IDEA_HOME%/config/templates下,一般在C:/Documents and Settings/hunterk/.IntelliJIdea60/config/templates

 下载hibernate.xml


<? xml version="1.0" encoding="UTF-8" ?>

< templateSet  group ="hibernate" >

< template  name ="hib.array"  value ="@hibernate.array table=&quot;$table$&quot;&#10;* 
  cascade=&quot;$cascade$&quot;&#10;"

  description
="Defines an array"  toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="table"  expression ="&quot;&quot;"  defaultValue ="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"  defaultValue ="&quot;update&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.bag"  value ="@hibernate.bag

inverse=&quot;$readonly$&quot;&#10;* table=&quot;$table$&quot;&#10;*

lazy=&quot;$lazy$&quot;&#10;* cascade=&quot;$cascade$&quot;&#10; "


description
="Defines a bag"  toReformat ="true"

toShortenFQNames
="true" >

< variable  name ="readonly"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="table"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="lazy"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.class"  value ="@hibernate.class

table=&quot;$table$&quot;&#10;* mutable=&quot;$mutable$&quot;&#10;*

proxy=&quot;$proxy$&quot;"
 description ="Used to generate decriptor file for

Hibernate"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="table"  expression ="decapitalize(className())"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="mutable"  expression ="&quot;&quot;"

defaultValue
="&quot;read-write&quot;"  alwaysStopAt ="true"   />

< variable  name ="proxy"  expression ="qualifiedClassName()"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.colele"  value ="@hibernate.collection-element

column=&quot;$column$&quot;"
 description ="Declares a collection element"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.colidx"  value ="@hibernate.collection-index

column=&quot;$column$&quot;"
 description ="Declares a collection index"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.colkey"  value ="@hibernate.collection-key

column=&quot;$column$&quot;&#10;*

generator-class=&quot;$generatorclass$&quot;"
 description ="Declares a collection

key"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="generatorclass"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.colmtm"  value ="@hibernate.collection-many-to-many

column=&quot;$column$&quot;&#10;* class=&quot;$class$&quot;"


description
="Declares a many-to-many relationship"  toReformat ="true"

toShortenFQNames
="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="class"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.colotm"  value ="@hibernate.collection-one-to-many

class=&quot;$class$&quot;"
 description ="Declares a one-to-many relationship"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="class"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.comele"  value ="@hibernate.composite-element

class=&quot;$class$&quot;"
 description ="Declares a composite collection

element"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="class"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.comp"  value ="@hibernate.component

class=&quot;$class$&quot;"
 description ="Declare a component"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="class"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.disc"  value ="@hibernate.discriminator

column=&quot;$column$&quot;"
 description ="Defines a discriminator"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.id"  value ="@hibernate.id

column=&quot;$column$&quot;&#10;*

unsaved-value=&quot;$unsavedvalue$&quot;&#10;*

generator-class=&quot;$generatorclass$&quot;&#10;"
 description ="Declares an

identifier property"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="unsavedvalue"  expression ="&quot;&quot;"

defaultValue
="&quot;null&quot;"  alwaysStopAt ="true"   />

< variable  name ="generatorclass"  expression ="&quot;&quot;"

defaultValue
="&quot;native&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.list"  value ="@hibernate.list

table=&quot;$table$&quot;&#10;* lazy=&quot;$lazy$&quot;&#10;*

cascade=&quot;$cascade$&quot;&#10; "
 description ="Defines a list"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="table"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="lazy"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.map"  value ="@hibernate.map

table=&quot;$table$&quot;&#10;* lazy=&quot;$lazy$&quot;&#10;*

cascade=&quot;$cascade$&quot;&#10; "
 description ="Defines a map"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="table"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="lazy"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.mto"  value ="@hibernate.many-to-one

column=&quot;$column$&quot;&#10;* cascade=&quot;$cascade$&quot;&#10;*

class=&quot;$class$&quot;&#10;* outer-join=&quot;$outerjoin$&quot;&#10;*

unique=&quot;$unique$&quot;&#10; "
 description ="Declares a many-to-one

association"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

< variable  name ="class"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="outerjoin"  expression ="&quot;&quot;"

defaultValue
="&quot;auto&quot;"  alwaysStopAt ="true"   />

< variable  name ="unique"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.oto"  value ="@hibernate.one-to-one

cascade=&quot;$cascade$&quot;&#10;* class=&quot;$class$&quot;&#10;*

outer-join=&quot;$outerjoin$&quot;&#10; "
 description ="Declares a one-to-one

association"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

< variable  name ="class"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="outerjoin"  expression ="&quot;&quot;"

defaultValue
="&quot;auto&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.parray"  value ="@hibernate.primitive-array

table=&quot;$table$&quot;&#10;* cascade=&quot;$cascade$&quot;&#10; "


description
="Defines a primitive array"  toReformat ="true"

toShortenFQNames
="true" >

< variable  name ="table"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.prop"  value ="@hibernate.property

column=&quot;$column$&quot;&#10;* not-null=&quot;$notnull$&quot;&#10;*

unique=&quot;$unique$&quot;&#10;"
 description ="Defines a property"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="notnull"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="unique"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.query"  value ="@hibernate.query

name=&quot;$name$&quot;&#10;* query=&quot;$query$&quot;"


description
="Declares a named query for class"  toReformat ="true"

toShortenFQNames
="true" >

< variable  name ="name"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="query"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.set"  value ="@hibernate.set

inverse=&quot;$readonly$&quot;&#10;* table=&quot;$table$&quot;&#10;*

lazy=&quot;$lazy$&quot;&#10;* cascade=&quot;$cascade$&quot;&#10; "


description
="Defines a set"  toReformat ="true"

toShortenFQNames
="true" >

< variable  name ="readonly"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="table"  expression ="&quot;&quot;"

defaultValue
="&quot;&quot;"  alwaysStopAt ="true"   />

< variable  name ="lazy"  expression ="&quot;&quot;"

defaultValue
="&quot;false&quot;"  alwaysStopAt ="true"   />

< variable  name ="cascade"  expression ="&quot;&quot;"

defaultValue
="&quot;update&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.subclass"  value ="@hibernate.subclass

discriminator-value=&quot;$expr$&quot;"
 description ="Declare the current class as

subclass"
 toReformat ="true"  toShortenFQNames ="true" >

< variable  name ="expr"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.ts"  value ="@hibernate.timestamp

column=&quot;$column$&quot;"
 description ="Declares a timestamp property"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

< template  name ="hib.ver"  value ="@hibernate.version

column=&quot;$column$&quot;"
 description ="Declares a version property"

toReformat
="true"  toShortenFQNames ="true" >

< variable  name ="column"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="type"  expression ="&quot;&quot;"

defaultValue
=""  alwaysStopAt ="true"   />

< variable  name ="unsavedvalue"  expression ="&quot;&quot;"

defaultValue
="&quot;null&quot;"  alwaysStopAt ="true"   />

< variable  name ="generatorclass"  expression ="&quot;&quot;"

defaultValue
="&quot;native&quot;"  alwaysStopAt ="true"   />

    
< context >

      
< option  name ="JAVA_CODE"  value ="false"   />

      
< option  name ="JAVA_COMMENT"  value ="true"   />

      
< option  name ="JAVA_STRING"  value ="false"   />

      
< option  name ="XML"  value ="false"   />

      
< option  name ="HTML"  value ="false"   />

      
< option  name ="JSP"  value ="false"   />

      
< option  name ="COMPLETION"  value ="false"   />

      
< option  name ="OTHER"  value ="false"   />

    
</ context >

  
</ template >

</ templateSet >

 

 2.重启Idea

 3.在Idea的File->Setting->Errors->IDE Profiles->Default->Inspections->General->Declaration has javadoc problems->Additional JavaDoc Tags的对话框添加以下内容:

 

hibernate.class , hibernate.discriminator , hibernate.subclass ,   hibernate.query , hibernate.property , hibernate.component ,   hibernate.id , hibernate.version ,, hibernate.timestamp ,   hibernate.many-to-one , hibernate.one-to-one , hibernate.set ,   hibernate.bag , hibernate.list , hibernate.map , hibernate.array ,   hibernate.primitive-array , hibernate.collection-key ,   hibernate.collection-index , hibernate.collection-element ,   hibernate.composite-element , hibernate.collection-many-to-many ,   hibernate.collection-one-to-many

如图:

 

4.使用在编写代码时按Ctrl+Space (如果你的这个热键给输入法占了,设置别的热键吧!)

 

5.附件:Hibernate的Xdoclet Live Templates


hib.array
/**
 * @hibernate.array table
= " $table "
 *                cascade
= " $cascade "
 **/
where $table defaults to 
"" ,  and $cascade defaults to  " update "

hib.bag
/**
 * @hibernate.bag inverse
= " $inverse "
 *                  table
= " $table "
 *                   lazy
= " $lazy "
 *                cascade
= " $cascade "
 **/
where $inverse defaults to 
" false " ,  $table defaults to  "" ,  $lazy defaults to  " false " ,  and $cascade defaults to  " update "

hib.class
/**
 * @hibernate.class table
= " $table "
 *                mutable
= " $mutable "
 *                  proxy
= " $proxy "
 **/
where $table defaults to decapitalize(className())
,  $mutable defaults to  " true " ,  and $proxy defaults to qualifiedClassName()

hib.colele
/**
 * @hibernate.collection-element column
= " $column "
 **/
where $column defaults to 
""

hib.colidx
/**
 * @hibernate.collection-index column
= " $column "
 **/
where $column defaults to 
""

hib.colkey
/**
 * @hibernate.collection-key column
= " $column "
 *                  generator-class
= " $generatorclass "
 **/
where $column defaults to 
"" ,  and $generatorclass defaults to  ""

hib.colmtm
/**
 * @hibernate.collection-many-to-many column
= " $column "
 *                                     class
= " $class "
 **/
where $column defaults to 
"" ,  and $class defaults to  ""

hib.colotm
/**
 * @hibernate.collection-one-to-many class
= " $class "
 **/
where $class defaults to 
""

hib.comele
/**
 * @hibernate.composite-element class
= " $class "
 **/
where $class defaults to 
""

hib.comp
/**
 * @hibernate.component class
= " $class "
 **/
where $class defaults to 
""

hib.disc
/**
 * @hibernate.discriminator column
= " $column "
 **/
where $column defaults to 
""

hib.id
/**
 * @hibernate.id column
= " $column "
 *        unsaved-value
= " $unsavedvalue "
 *      generator-class
= " $generatorclass "
 **/
where $column defaults to 
"" ,  $unsavedvalue defaults to  " null " ,  and $generatorclass defaults to  " native "

hib.list
/**
 * @hibernate.list table
= " $table "
 *                  lazy
= " $lazy "
 *               cascade
= " $cascade "
 **/
where $table defaults to 
"" ,  $lazy defaults to  " false " ,  and $cascade defaults to  " update "

hib.map
/**
 * @hibernate.map table
= " $table "
 *                 lazy
= " $lazy "
 *              cascade
= " $cascade "
 **/
where $table defaults to 
"" ,  $lazy defaults to  " false " ,  and $cascade defaults to  " update "

hib.mto
/**
 * @hibernate.many-to-one column
= " $column "
 *                       cascade
= " $cascade "
 *                         class
= " $class "
 *                    outer-join
= " $outerjoin "
 *                        unique
= " $unique "
 **/
where $column defaults to 
"" ,  $cascade defaults to  " update " ,  $class defaults to  "" ,  $outerjoin defaults to  " auto " ,  and $unique defaults to  " false "

hib.oto
/**
 * hibernate.one-to-one cascade
= " $cascade "
 *                        class
= " $class "
 *                   outer-join
= " $outerjoin "
 **/
where $cascade defaults to 
" update " ,  $class defaults to  "" ,  and $outerjoin defaults to  " auto "

hib.parray4
/**
 * @hibernate.primitive-array table
= " $table "
 *                          cascade
= " $cascade "
 **/
where $table defaults to 
"" ,  and $cascade defaults to  " update "

hib.prop 
/**
 * hibernate.property column
= " $column "
 *                  not-null
= " $notnull "
 *                    unique
= " $unique "
 **/
where $column defaults to 
"" ,  $notnull defaults to  " false " ,  and $unique defaults to  " false "

hib.query 
/**
 *@hibernate.query name
= " $name "
 *                query
= " $query "
 **/
where $name defaults to 
"" ,  and $query defaults to  ""

hib.set
/**
 * @hibernate.set inverse
= " $inverse "
 *                  table
= " $table "
 *                   lazy
= " $lazy "
 *                cascade
= " $cascade "
 **/
where $inverse defaults to 
" false " ,  $table defaults to  "" ,  $lazy defaults to  " false " ,  and $cascade defaults to  " update "

hib.subclass
/**
 * @hibernate.subclass discriminator-value
= " $discriminatorvalue "
 **/
where $discriminatorvalue defaults to 
""

hib.ts 
/**
 * @hibernate.timestamp column
= " $column "
 **/
where $column defaults to 
""

hib.ver
/**
 * @hibernate.version column
= " $column "
 **/
where $column defaults to 
""

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值