Mybatise插件

https://github.com/mybatis/mybatipse

 功能很强大

Auto-completion
  • Mapper namespace : Calculated from the path.
    autocomplete namespaceautocomplete namespace
  • Java class/Type alias : Propose Java classes and Type Aliases (translucent icons). Camelcase match is supported. [1] [2]
    autocomplete class autocomplete class
  • Java property : Propose properties of the parent java class. Nested properties are supported.
    autocomplete property autocomplete property
  • Statement ID : If corresponding mapper interface exists, propose the method name as a statement ID.
    autocomplete statement id
  • Reference to resultMap/select/sql : Propose ID of the referenced resultMap/select/sql. External reference is supported (blue icons).
    autocomplete reference
  • Parameter properties : #{} and ${} in select/insert/udpate/delte statements. Also works in some attributes.
    autocomplete properties autocomplete properties 2
  • javaType, jdbcType, typeHandler in #{}
    autocomplete jdbcType
  • Result elements in resultMap/collection/association : Generates elements for the parent java class properties.
    autocomplete results 1 autocomplete results 2

  • [1] For better performance, classes in the application libraries (loaded as JARs) are listed only when at least one package segment is specified.

  • [2] There is a limitation for the type alias support. Basically, if type aliases are registered using Java API, they are not automatically detected. As a workaround, you can register type aliases in MyBatipse's preference. See the Configurationsection.
Hyperlinks
  • To referenced resultMap/select/sql element. External reference is supported.
    link to external reference
  • From Java mapper interface to XML mapper element.
    link to xml mapper
  • From Java mapper method to XML mapper element.
    link to xml statement
  • From XML statement id to Java mapper method.
    link to java method
Validation
  • Missing TypeAlias, Java class/property.
  • Missing resultMap/select/sql ID.
  • etc.
    refid error problem view
Mapper Declaration View

Java Editor Enhancements

Auto-completion
  • Parameter properties : #{} and ${} in select/insert/udpate/delte annotations. autocomplete properties in java
  • Return type properties in @Result
    autocomplete return type properties in java
  • keyProperty in @Options and @SelectKey
    autocomplete return type properties in java
    autocomplete return type properties in java
  • javaType, jdbcType, typeHandler in #{} : See the XML example.
  • Reference to resultMap in @ResultMap
    autocomplete resultmap annotation
Quick Assist

Put the cursor on the statement method name and press cmd + 1 (or ctrl + 1) to trigger Quick Assist.

  • You can add @Param to method parameters.
    param-annotation1
    param-annotation2
  • You can copy annotation statement into the clipboard.param-annotation1

Configuration

XML mapper location

  • MyBatipse searches XML mapper files under your project's Source Folder. To make a directory Source Folder, right click the directory in the package explorer and choose Build Path -> Use as Source Folder from the menu.

MyBatis Nature

  • By default, each file is validated when it's saved, but you would want to validate the XML mapper when the related Java classes are updated as well. For that purpose, MyBatipse provides a custom nature MyBatis Nature.
    To add the nature, right click the project in the package explorer and choose Configure -> Add MyBatis Nature from the menu.
    nature

Type Alias

  • Type alias are automatically detected if they are registered using XML config file (both mybatis and mybatis-spring config is supported).
    If you register type aliases in Java code, MyBatipse cannot detect them. As a workaround, you can register custom type aliases in the project setting (Open Project -> Properties menu and select MyBatipse from the left column).
    type aliases
    For example, with the above settings:
    • The first entry registers all the classes in com.example.domain package as type aliases.
    • The second entry registers the single class domain.Person.
    • The third entry registers the single class domain.SomeLongNamedBean under the alias SomeBean.
    • Note that, in any case, MyBatipse respects @Alias annotation if it exists.

Tips

  • To move MyBatis proposals to the top of the XML proposal list, quit Eclipse and open the following file in the workspace:.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.xml.ui.prefs Find the line started withxml_content_assist_default_page_sort_order= and insert net.harawata.mybatis.proposalCategory.xml\u0000 right after the equal sign.
    xml proposal order

Installation

There are several ways to install MyBatipse.

  • Drag this button drag-to-install button from browser to your Eclipse workbench (i.e. window).
  • Choose Eclipse Marketplace... in Help menu of your Eclipse and search MyBatipse.
  • Choose Install New Software... in Help menu and enter the following URL.
    http://dl.bintray.com/harawata/eclipse

Bugs, questions, suggestions, etc.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值