IDEA使用技巧

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值