1.更改Ctrl+space 快捷键:
在设置对话框中的keymap/All Actions/Main menu/Code/Complete Code /Basic /下更改 为
alt+/
2.引入hibernate live templeates :
http://www.hibernate.org/108.html
Live Template XML (hibernate.xml)
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="hibernate">
<template name="hib.array" value="@hibernate.array table="$table$" *
cascade="$cascade$" "
description="Defines an array" toReformat="true" toShortenFQNames="true">
<variable name="table" expression="""" defaultValue="""" alwaysStopAt="true" />
<variable name="cascade" expression="""" defaultValue=""update"" 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="$readonly$" * table="$table$" *
lazy="$lazy$" * cascade="$cascade$" "
description="Defines a bag" toReformat="true"
toShortenFQNames="true">
<variable name="readonly" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="table" expression=""""
defaultValue="""" alwaysStopAt="true" />
<variable name="lazy" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="cascade" expression=""""
defaultValue=""update"" 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="$table$" * mutable="$mutable$" *
proxy="$proxy$"" 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=""""
defaultValue=""read-write"" 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="$column$"" description="Declares a collection element"
toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
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="$column$"" description="Declares a collection index"
toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
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="$column$" *
generator-class="$generatorclass$"" description="Declares a collection
key" toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="generatorclass" expression=""""
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="$column$" * class="$class$""
description="Declares a many-to-many relationship" toReformat="true"
toShortenFQNames="true">
<variable name="column" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="class" expression=""""
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.colotm" value="@hibernate.collection-one-to-many
class="$class$"" description="Declares a one-to-many relationship"
toReformat="true" toShortenFQNames="true">
<variable name="class" expression=""""
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.comele" value="@hibernate.composite-element
class="$class$"" description="Declares a composite collection
element" toReformat="true" toShortenFQNames="true">
<variable name="class" expression=""""
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.comp" value="@hibernate.component
class="$class$"" description="Declare a component"
toReformat="true" toShortenFQNames="true">
<variable name="class" expression=""""
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="$column$"" description="Defines a discriminator"
toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
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="$column$" *
unsaved-value="$unsavedvalue$" *
generator-class="$generatorclass$" " description="Declares an
identifier property" toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="unsavedvalue" expression=""""
defaultValue=""null"" alwaysStopAt="true" />
<variable name="generatorclass" expression=""""
defaultValue=""native"" 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="$table$" * lazy="$lazy$" *
cascade="$cascade$" " description="Defines a list"
toReformat="true" toShortenFQNames="true">
<variable name="table" expression=""""
defaultValue="""" alwaysStopAt="true" />
<variable name="lazy" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="cascade" expression=""""
defaultValue=""update"" 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="$table$" * lazy="$lazy$" *
cascade="$cascade$" " description="Defines a map"
toReformat="true" toShortenFQNames="true">
<variable name="table" expression=""""
defaultValue="""" alwaysStopAt="true" />
<variable name="lazy" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="cascade" expression=""""
defaultValue=""update"" 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="$column$" * cascade="$cascade$" *
class="$class$" * outer-join="$outerjoin$" *
unique="$unique$" " description="Declares a many-to-one
association" toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="cascade" expression=""""
defaultValue=""update"" alwaysStopAt="true" />
<variable name="class" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="outerjoin" expression=""""
defaultValue=""auto"" alwaysStopAt="true" />
<variable name="unique" expression=""""
defaultValue=""false"" 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="$cascade$" * class="$class$" *
outer-join="$outerjoin$" " description="Declares a one-to-one
association" toReformat="true" toShortenFQNames="true">
<variable name="cascade" expression=""""
defaultValue=""update"" alwaysStopAt="true" />
<variable name="class" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="outerjoin" expression=""""
defaultValue=""auto"" 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="$table$" * cascade="$cascade$" "
description="Defines a primitive array" toReformat="true"
toShortenFQNames="true">
<variable name="table" expression=""""
defaultValue="""" alwaysStopAt="true" />
<variable name="cascade" expression=""""
defaultValue=""update"" 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="$column$" * not-null="$notnull$" *
unique="$unique$" " description="Defines a property"
toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="notnull" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="unique" expression=""""
defaultValue=""false"" 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="$name$" * query="$query$""
description="Declares a named query for class" toReformat="true"
toShortenFQNames="true">
<variable name="name" expression=""""
defaultValue="""" alwaysStopAt="true" />
<variable name="query" expression=""""
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.set" value="@hibernate.set
inverse="$readonly$" * table="$table$" *
lazy="$lazy$" * cascade="$cascade$" "
description="Defines a set" toReformat="true"
toShortenFQNames="true">
<variable name="readonly" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="table" expression=""""
defaultValue="""" alwaysStopAt="true" />
<variable name="lazy" expression=""""
defaultValue=""false"" alwaysStopAt="true" />
<variable name="cascade" expression=""""
defaultValue=""update"" 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="$expr$"" description="Declare the current class as
subclass" toReformat="true" toShortenFQNames="true">
<variable name="expr" expression=""""
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="$column$"" description="Declares a timestamp property"
toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
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="$column$"" description="Declares a version property"
toReformat="true" toShortenFQNames="true">
<variable name="column" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="type" expression=""""
defaultValue="" alwaysStopAt="true" />
<variable name="unsavedvalue" expression=""""
defaultValue=""null"" alwaysStopAt="true" />
<variable name="generatorclass" expression=""""
defaultValue=""native"" 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>