├── wiki ├── Source.wiki ├── Downloads.wiki ├── Issues.wiki ├── Migration.wiki ├── Welcome.wiki ├── Related.wiki ├── DocMavenTutorial.wiki ├── GPGKeys.wiki ├── CLA.wiki ├── HowTos.wiki ├── DocContrib.wiki ├── Samples.wiki ├── Sidebar.wiki ├── Scripting.wiki ├── UserGuides.wiki ├── Generator.wiki ├── Contribute.wiki ├── svn2git.wiki ├── Test.wiki ├── ResultHandlerExample.wiki ├── FaqJapanese.wiki ├── FeedbackWho.wiki ├── Spring.wiki ├── Guice.wiki ├── faq.wiki ├── Caches.wiki ├── FeedbackArticles.wiki ├── DocIbatis2MyBatis.wiki ├── ProcessRelease.wiki ├── DocUpgrade3.wiki └── FeedbackTestimonial.wiki ├── CODE_MOVED_TO_GITHUB.txt ├── PULL_REQUEST_TEMPLATE.md ├── sub-projects └── generator │ └── trunk │ └── eclipse │ └── UpdateSite │ ├── features │ ├── org.mybatis.generator_1.3.1.201101032122.jar │ ├── org.mybatis.generator_1.3.2.201207161521.jar │ ├── org.mybatis.generator.source_1.3.1.201101032122.jar │ └── org.mybatis.generator.source_1.3.2.201207161521.jar │ ├── plugins │ ├── org.mybatis.generator.core_1.3.1.201101032122.jar │ ├── org.mybatis.generator.core_1.3.2.201207161521.jar │ ├── org.mybatis.generator.core.source_1.3.1.201101032122.jar │ ├── org.mybatis.generator.core.source_1.3.2.201207161521.jar │ ├── org.mybatis.generator.eclipse.doc_1.3.1.201101032122.jar │ ├── org.mybatis.generator.eclipse.doc_1.3.2.201207161521.jar │ ├── org.mybatis.generator.eclipse.ui_1.3.1.201101032122.jar │ ├── org.mybatis.generator.eclipse.ui_1.3.2.201207161521.jar │ ├── org.mybatis.generator.eclipse.core_1.3.1.201101032122.jar │ ├── org.mybatis.generator.eclipse.core_1.3.2.201207161521.jar │ ├── org.mybatis.generator.eclipse.core.source_1.3.1.201101032122.jar │ ├── org.mybatis.generator.eclipse.core.source_1.3.2.201207161521.jar │ ├── org.mybatis.generator.eclipse.ui.source_1.3.1.201101032122.jar │ └── org.mybatis.generator.eclipse.ui.source_1.3.2.201207161521.jar │ └── artifacts.xml ├── ISSUE_TEMPLATE.md └── README.md /wiki/Source.wiki: -------------------------------------------------------------------------------- 1 | Find !MyBatis sources at [https://github.com/mybatis Github] -------------------------------------------------------------------------------- /wiki/Downloads.wiki: -------------------------------------------------------------------------------- 1 | Download !MyBatis binaries from [http://blog.mybatis.org/p/products.html mybatis.org] -------------------------------------------------------------------------------- /CODE_MOVED_TO_GITHUB.txt: -------------------------------------------------------------------------------- 1 | WARNING! - These sources are outdated. 2 | 3 | MyBatis project sources and history is now at https://github.com/mybatis 4 | -------------------------------------------------------------------------------- /wiki/Issues.wiki: -------------------------------------------------------------------------------- 1 | 2 | Since !MyBatis 3.2 the project issue tracker is at [https://github.com/mybatis Github] 3 | 4 | You can still access the [http://code.google.com/p/mybatis/issues/list old tracker] to see past issues. -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | =========================== 2 | STOP! 3 | =========================== 4 | 5 | This repository is not used. 6 | Issues and pull requests will be closed without comment. 7 | 8 | The new repositories are here: https://github.com/mybatis 9 | -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | =========================== 2 | Do NOT create a new issue! 3 | =========================== 4 | 5 | This repository exists just to keep the old issues migrated from our old project home on Google Code. 6 | The new repositories are here: https://github.com/mybatis 7 | -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator.source_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator.source_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator.source_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/features/org.mybatis.generator.source_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core.source_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core.source_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core.source_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.core.source_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.doc_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.doc_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.doc_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.doc_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /wiki/Migration.wiki: -------------------------------------------------------------------------------- 1 | #summary The MyBatis Schema Migrations tool 2 | 3 | =See migrations project at Github= 4 | 5 | * [http://github.com/mybatis/migrations Project] * 6 | 7 | * [http://mybatis.github.io/migrations Docs] * 8 | 9 | * [http://github.com/mybatis/migrations/releases Downloads] * -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core.source_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core.source_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core.source_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.core.source_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui.source_1.3.1.201101032122.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui.source_1.3.1.201101032122.jar -------------------------------------------------------------------------------- /sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui.source_1.3.2.201207161521.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybatis/old-google-code-issues/master/sub-projects/generator/trunk/eclipse/UpdateSite/plugins/org.mybatis.generator.eclipse.ui.source_1.3.2.201207161521.jar -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repository exists just to keep the old issues migrated from our old project home on Google Code. 2 | Please do not submit a new issue or add comments to existing issues and contribute to [the new repositories](https://github.com/mybatis) instead. 3 | 4 | And if you have a question, please use the [mailing list](http://groups.google.com/group/mybatis-user). 5 | We use GitHub Issues only to track bugs and feature requests. 6 | 7 | Thank you! 8 | -------------------------------------------------------------------------------- /wiki/Welcome.wiki: -------------------------------------------------------------------------------- 1 | == What is !MyBatis? == 2 | 3 | !MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. !MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. !MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records. 4 | 5 | 6 | http://mybatis.org/images/flow.png -------------------------------------------------------------------------------- /wiki/Related.wiki: -------------------------------------------------------------------------------- 1 | #summary Related 3rd party projects 2 | 3 | = Introduction = 4 | 5 | The following is a list of external projects related to !MyBatis. 6 | 7 | Please let us know if you are developing a tool or a plugin, so we can add it to this list. 8 | 9 | = Related projects = 10 | 11 | || Project name || Description || Site || 12 | || !MyBatisEditor || !MyBatis Eclipse Plugin || http://code.google.com/a/eclipselabs.org/p/mybatiseditor/ || 13 | || Cacheonix || Distributed !MyBatis Cache || http://www.cacheonix.com || -------------------------------------------------------------------------------- /wiki/DocMavenTutorial.wiki: -------------------------------------------------------------------------------- 1 | = !MyBatis & Maven = 2 | 3 | The following is the Maven group, artifact and version for !MyBatis. 4 | 5 | {{{ 6 | 7 | org.mybatis 8 | mybatis 9 | 3.1.1 10 | 11 | }}} 12 | 13 | If you are looking to try the latest and greatest you can use our snapshot repository. Just add the following to your project's pom.xml or to a profile defined in your settings.xml. 14 | 15 | {{{ 16 | 17 | mybatis-snapshot 18 | MyBatis Snapshot Repository 19 | https://oss.sonatype.org/content/repositories/snapshots 20 | 21 | }}} -------------------------------------------------------------------------------- /wiki/GPGKeys.wiki: -------------------------------------------------------------------------------- 1 | = GPG Keys = 2 | 3 | The file located on 4 | 5 | {{{ https://mybatis.googlecode.com/svn/committers/KEYS }}} 6 | 7 | contains the !MyBatis developers GPG keys. Users can import the keys to verify the artifact signatures. 8 | 9 | = Users = 10 | 11 | Checkout the file by running 12 | 13 | {{{ svn co https://mybatis.googlecode.com/svn/committers }}} 14 | 15 | and run 16 | 17 | {{{ gpg --import KEYS }}} 18 | 19 | = Developers = 20 | 21 | Checkout the file by running 22 | 23 | {{{ svn co https://mybatis.googlecode.com/svn/committers }}} 24 | 25 | and run 26 | 27 | {{{ (gpg --list-sigs && gpg --armor --export ) >> KEYS }}} 28 | 29 | then recommit 30 | 31 | {{{ svn ci -m "added simone's gpg key" }}} -------------------------------------------------------------------------------- /wiki/CLA.wiki: -------------------------------------------------------------------------------- 1 | = Contributor License Agreement = 2 | 3 | !MyBatis desires that all contributors of ideas, code, or documentation to !MyBatis projects complete, sign, and submit (via email) an [http://mybatis.googlecode.com/svn/trunk/ICLA Individual Contributor License Agreement] (CLA). The purpose of this agreement is to clearly define the terms under which intellectual property has been contributed to !MyBatis and thereby allow us to defend the project should there be a legal dispute regarding the software at some future time. A signed CLA is required to be on file before an individual is given commit rights to !MyBatis project. 4 | 5 | CLAs may be submitted by traditional postal mail, fax, or by emailing a scan of the signed copy to Clinton Begin or Simone Tripodi. -------------------------------------------------------------------------------- /wiki/HowTos.wiki: -------------------------------------------------------------------------------- 1 | #summary How Tos and Dummy Guides 2 | 3 | = Introduction = 4 | 5 | The !MyBatis 3 User Guide is excellent, but is lacking in examples. This selection of How Tos aims to help novice users quickly implement every day features which make MyBatis so powerful. 6 | 7 | Where possible, the examples from the User Guide or the [http://code.google.com/p/mybatis/source/browse/#svn/sub-projects/contact_manager%3Fstate%3Dclosed contact manger example] will be used 8 | 9 | = How Tos = 10 | 11 | == Select == 12 | * [HowToSelectMultipleParams Select with multiple parameters] 13 | 14 | == Insert == 15 | * Implementing auto increatment ID field in Oracle and Mybatis (coming soon) 16 | 17 | == ResultHandler == 18 | * [ResultHandlerExample Handle results from complex queries] -------------------------------------------------------------------------------- /wiki/DocContrib.wiki: -------------------------------------------------------------------------------- 1 | #summary How to contribute documentation to MyBatis 2 | 3 | = Help out! = 4 | 5 | You make the best author of the documentation, because you are a user of the framework and therefore have a better perspective for what it takes to explain and use !MyBatis. 6 | 7 | There are a few ways you can contribute to the documentation: 8 | 9 | * Checkout the xdoc manual from http://mybatis.googlecode.com/svn/trunk/src/site or the wiki from http://mybatis.googlecode.com/svn/wiki, modify it, create a patch and fill an [http://code.google.com/p/mybatis/issues/list Issue] with it. 10 | 11 | * Submit an issue with the description containing the newly created documents that you'd like to contribute (Issue Tracker supports wiki formatting). 12 | 13 | * Make a request to the user list regarding documentation that is missing. -------------------------------------------------------------------------------- /wiki/Samples.wiki: -------------------------------------------------------------------------------- 1 | = Code Samples = 2 | == JPetStore 6 == 3 | 6th version of the JPetStore family. Built on !MyBatis 3, Stripes and Spring. 4 | 5 | This sample shows how to build a full Web application in a simple way and coding as less as possible. This version of JPetStore is composed by just 24 java classes. 6 | 7 | Get it from [http://code.google.com/p/mybatis/downloads/list?can=3&q=Product%3DSample] 8 | 9 | And have a look at its documentation at [http://www.mybatis.org/spring/sample.html] 10 | 11 | == Contact Manager == 12 | A simple application built with Stripes, Google Guice and !MyBatis 3 that lets you manage a contact list. 13 | 14 | Check it out from [http://code.google.com/p/mybatis/source/browse/#svn%2Fsub-projects%2Fcontact_manager] 15 | 16 | == Scala Code Samples (beta2) == 17 | Basic code samples: 18 | [https://github.com/mnesarco/mybatis-scala-samples-beta2] 19 | 20 | Play Framework 2.0 Sample Application: 21 | [http://www.fdmtech.org/2012/03/a-better-example-of-play-framework-2-0-with-mybatis-for-scala-beta/] -------------------------------------------------------------------------------- /wiki/Sidebar.wiki: -------------------------------------------------------------------------------- 1 | #summary Contents 2 | 3 | === Wiki === 4 | 5 | * [Welcome Welcome Page] 6 | * [http://code.google.com/p/mybatis/w/list Page List] 7 | 8 | === Documentation === 9 | * [UserGuides User Guides] 10 | * [Samples Code Samples] 11 | * [FeedbackArticles Tutorials and Books] 12 | * [DocMavenTutorial MyBatis & Maven] 13 | * [DocUpgrade3 From iBATIS 2.x to MyBatis] 14 | * [faq Frequently Asked Questions] 15 | 16 | === Tools === 17 | 18 | * [Migration Schema Migrations Tool] 19 | * [Generator MyBatis Generator] 20 | 21 | === Extras === 22 | 23 | * [Spring Spring Integration] 24 | * [Guice Guice Integration] 25 | * [Caches 3rd party caches] 26 | * [Scripting 3rd party scripting engines] 27 | 28 | === Related Projects === 29 | 30 | * [Related MyBatis related projects] 31 | 32 | === Process === 33 | 34 | * [ProcessRelease Release Process] 35 | * [GPGKeys GPG keys] 36 | 37 | === Contributions === 38 | 39 | * [Contribute Get Involved] 40 | * [Test Create a Test] 41 | * [DocContrib Contribute Documentation] 42 | * [CLA Contributor License Agreements] 43 | 44 | === Feedback and Testimonials === 45 | 46 | * [FeedbackWho Who's using MyBatis] 47 | * [FeedbackTestimonial Feedback and Testimonials] -------------------------------------------------------------------------------- /wiki/Scripting.wiki: -------------------------------------------------------------------------------- 1 | #summary 3rd party scripting engines 2 | 3 | = Introduction = 4 | 5 | !MyBatis 3.2+ supports pluggable scripting engines so that you can build your dinamic queries using your preferred language. 6 | 7 | == Velocity == 8 | 9 | [http://velocity.apache.org Velocity] is a template engine that can be used for many purposes. 10 | 11 | If you are not familiar with apache velocity, you can learn it from its documentation site: 12 | 13 | To install the plugin in your project, add the dependency: 14 | 15 | {{{ 16 | 17 | ... 18 | 19 | org.mybatis.scripting 20 | mybatis-velocity 21 | xxx 22 | 23 | ... 24 | 25 | }}} 26 | 27 | Register the language driver alias in your mybatis configuration file: 28 | 29 | {{{ 30 | 31 | ... 32 | 33 | 34 | 35 | ... 36 | 37 | }}} 38 | 39 | Optional: Set the velocity as your default scripting language: 40 | 41 | {{{ 42 | 43 | ... 44 | 45 | 46 | 47 | ... 48 | 49 | }}} 50 | 51 | Now you can write dynamic statements like this one: 52 | 53 | {{{ 54 | 60 | }}} 61 | 62 | For further info read the [http://mybatis.github.io/velocity-scripting/ manual] -------------------------------------------------------------------------------- /wiki/UserGuides.wiki: -------------------------------------------------------------------------------- 1 | #summary MyBatis reference guides and javadocs. 2 | 3 | Follows below the list of URL of each sub-project where reference documentation, samples, javadocs and project reports can be found. 4 | 5 | = !MyBatis = 6 | 7 | * *[http://www.mybatis.org/core MyBatis Core Framework]* 8 | 9 | = Tools = 10 | 11 | * *[http://mybatis.org/generator/ MyBatis Generator Tool]* 12 | 13 | * *[http://www.mybatis.org/migrations MyBatis Schema Migrations Tool]* - for database change management 14 | 15 | * *[http://mybatis.org/maven-migration-plugin/ Schema Migrations Migrations plugin for Apache Maven]* 16 | 17 | = Extensions = 18 | 19 | == DI/IoC == 20 | 21 | * *[http://www.mybatis.org/spring MyBatis Spring Integration]* 22 | 23 | * *[http://www.mybatis.org/guice MyBatis Guice Integration]* 24 | 25 | == Language integrations == 26 | 27 | * *[http://www.mybatis.org/scala MyBatis Scala Integration]* 28 | 29 | == Caches == 30 | 31 | * *[http://www.mybatis.org/caches/oscache MyBatis OSCache Extension]* 32 | 33 | * *[http://www.mybatis.org/caches/ehcache MyBatis EhCache Extension]* 34 | 35 | * *[http://www.mybatis.org/caches/hazelcast MyBatis Hazelcast Extensions]* 36 | 37 | == Stripting == 38 | 39 | * *[http://www.mybatis.org/scripting/velocity MyBatis Velocity Extension]* 40 | 41 | = Samples = 42 | 43 | * *[http://www.mybatis.org/spring/sample.html JPetStore 6]* 44 | 45 | == Can't find what you need? == 46 | Try searching for old version or different language guides in the downloads which can be found [http://code.google.com/p/mybatis/downloads/list?can=3&q=Docs here]. 47 | 48 | ==Available Languages== 49 | * English 50 | * 한국어 (Korean) 51 | * 简体中文 (Simplified Chinese) 52 | * Español (Spanish) 53 | * 日本語 (Japanese) 54 | 55 | If you have the ability and desire to translate into other languages we would love to add more to the above list. 56 | 57 | For those of you living on the edge and helping the community to test out new features with snapshot releases you can find their user guides in svn. -------------------------------------------------------------------------------- /wiki/Generator.wiki: -------------------------------------------------------------------------------- 1 | #summary An introduction to the code generation tool for MyBatis 2 | 3 | == Introduction to !MyBatis Generator == 4 | 5 | !MyBatis Generator is a code generator for !MyBatis. !MyBatis Generator will introspect a database table (or many tables) and will generate !MyBatis artifacts that can be used to access the table(s). This abates some of the initial nuisance of setting up objects and configuration files to interact with database tables. !MyBatis Generator seeks to make a major impact on the large percentage of database operations that are simple CRUD (Create, Retrieve, Update, Delete). You will still need to hand code SQL and objects for custom queries, or stored procedures. 6 | 7 | !MyBatis Generator will generate: 8 | 9 | * !SqlMap XML Files 10 | * Java Classes to match the primary key and fields of the table(s) 11 | * Java Client Classes that use the above objects (optional) 12 | 13 | !MyBatis Generator can run as a standalone JAR file, as an Ant task, a Maven plugin, or 14 | an Eclipse plugin. 15 | 16 | == Get !MyBatis Generator == 17 | 18 | === Google Code === 19 | !MyBatis generator is available from the !MyBatis site at http://code.google.com/p/mybatis/downloads/list?can=3&q=Product%3DGenerator The bundle includes documentation for the generator. 20 | 21 | === Maven === 22 | !MyBatis generator is available in the Maven central repository at: 23 | ||*Group*||org.mybatis.generator|| 24 | ||*Artifact*||mybatis-generator-maven-plugin|| 25 | ||*Version*||1.3.2|| 26 | 27 | === Eclipse === 28 | !MyBatis generator is available as an Eclipse plugin and includes the extra 29 | capability of merging generated Java files as databases evolve. Documentation for 30 | !MyBatis generator is integrated into the Eclipse help system. To install the 31 | Eclipse plugin, configure a new Eclipse install repository and point to this location: 32 | 33 | http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/UpdateSite/ 34 | 35 | The plugin is currently developed and compiled with Eclipse Indigo SR2. It is also tested on Eclipse Juno and known to work there. -------------------------------------------------------------------------------- /wiki/Contribute.wiki: -------------------------------------------------------------------------------- 1 | #summary Description of how members of the community can contribute to the project. 2 | 3 | = Get Involved = 4 | 5 | There are many ways to get involved. 6 | 7 | * *Be active and helpful on the mailing lists* 8 | 9 | * *Find bugs* 10 | * Submit issues with failing unit tests 11 | * Submit patches that make the tests pass 12 | 13 | * *Create a new feature or modification* 14 | * Discuss your changes on the user mailing list to get feedback from the community 15 | * Submit new feature to the issue tracking system with passing tests 16 | * Attach the patch file (or even just the complete files if that works... we can diff easily enough) 17 | 18 | * *Write documentation* 19 | * Submit documentation contributions or changes directly in the body of the issue (which supports wiki markup). We'll add it to the official guide. 20 | 21 | = Copyright of contributions = 22 | 23 | * Everything you can find it this project is licensed under the Apache Software License 2.0 24 | 25 | * Every contribution you do *must* be licensed under the Apache Software License 2.0. Otherwise we will not be able to accept it. 26 | 27 | * Please make sure that all the new files you create hold the following header: 28 | 29 | {{{ 30 | /* 31 | * Copyright [year] the original author or authors. 32 | * 33 | * Licensed under the Apache License, Version 2.0 (the "License"); 34 | * you may not use this file except in compliance with the License. 35 | * You may obtain a copy of the License at 36 | * 37 | * http://www.apache.org/licenses/LICENSE-2.0 38 | * 39 | * Unless required by applicable law or agreed to in writing, software 40 | * distributed under the License is distributed on an "AS IS" BASIS, 41 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | * See the License for the specific language governing permissions and 43 | * limitations under the License. 44 | */ 45 | }}} 46 | 47 | * You are the author of your contributions and will always be, so you can add a @author tag with your name to the code you create. -------------------------------------------------------------------------------- /wiki/svn2git.wiki: -------------------------------------------------------------------------------- 1 | #summary One-sentence summary of this page. 2 | 3 | = IDs = 4 | 5 | {{{ 6 | bgoodin = Brandon Goodin 7 | brandon.goodin = Brandon Goodin 8 | cbegin = Clinton Begin 9 | clinton.begin = Clinton Begin 10 | clinton.begin@gmail.com = Clinton Begin 11 | chengt@gmail.com = Tim Chen 12 | christian.poitras@ircm.qc.ca = Christian Poitras 13 | eduardo.macarron = Eduardo Macarron 14 | eduardo.macarron@gmail.com = Eduardo Macarron 15 | gbayon = Gilles Bayon 16 | gus4000@gmail.com = Andrew Gustafson 17 | harawata@gmail.com = Iwao AVE! 18 | herman.bovens@gmail.com = Herman Bovens 19 | hpresnall = Hunter Presnall 20 | jeffgbutler = Jeff Butler 21 | jeffgbutler@gmail.com = Jeff Butler 22 | jgbutler = Jeff Butler 23 | larry.meadors = Larry Meadors 24 | lmeadors = Larry Meadors 25 | marco.speranza79 = Marco Speranza 26 | marco.speranza79@gmail.com = Marco Speranza 27 | mmccurrey = Michael McCurrey 28 | mnesarco = Frank Martínez 29 | mnesarco@gmail.com = Frank Martínez 30 | nathan.maves = Nathan Maves 31 | nathan.maves@gmail.com = Nathan Maves 32 | nmaves = Nathan Maves 33 | putthibongb = Putthibong Boonbong 34 | simone.tripodi = Simone Tripodi 35 | simone.tripodi@gmail.com = Simone Tripodi 36 | simonetripodi = Simone Tripodi 37 | jtirsen = Jon Tirsen 38 | roberto = Roberto Rabe 39 | sboden = Sven Boden 40 | schallm = Michael Schall 41 | kai = Kai Grabfelder 42 | husted = Ted Husted 43 | rgrabowski = Ron Grabowski 44 | hobbss = 45 | svm = 46 | }}} -------------------------------------------------------------------------------- /wiki/Test.wiki: -------------------------------------------------------------------------------- 1 | #summary How to create a Test to submit an issue. 2 | 3 | We appreciate that uses fill issues with bug reports, feature suggestions or new ideas. This is in fact the basis of the evoution of !MyBatis. 4 | 5 | To facilitate the adoption of your idea or to demonstrate a failure we would like to ask you to provide unit tests. A test will make life easier for everyone, it will be easier for you to explain the idea or problem and for team members to understand it and take an action. 6 | 7 | = Base Unit Test = 8 | 9 | Even if you are not familiarized with unit testing you will see that coding a unit test is an easy task. 10 | 11 | !MyBatis provides a sample base test that serves as a basis for your test. Check it out from here http://mybatis.googlecode.com/svn/trunk/src/test/java/org/apache/ibatis/submitted/basetest/ 12 | 13 | This test is quite simple, it is composed by the following files: 14 | * A JUnit test program called !BaseTest 15 | * A POJO called User 16 | * A Mapper interface called Mapper 17 | * A mybatis-config file called mybatis-config.xml 18 | * A mapper XML file called Mapper.xml 19 | * A database script called CreateDB.sql 20 | 21 | This is how it works. 22 | * !BaseTest.setUp() method builds an !SqlSessionFactory that uses an in-memory HSQLDB database: 23 | {{{ 24 | Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/basetest/mybatis-config.xml"); 25 | sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); 26 | reader.close(); 27 | }}} 28 | * Then it populates the database with the content of CreateDB.sql file: 29 | {{{ 30 | SqlSession session = sqlSessionFactory.openSession(); 31 | Connection conn = session.getConnection(); 32 | reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/basetest/CreateDB.sql"); 33 | ScriptRunner runner = new ScriptRunner(conn); 34 | runner.setErrorLogWriter(null); 35 | runner.runScript(reader); 36 | reader.close(); 37 | session.close(); 38 | }}} 39 | * !BaseTest.shouldGetAUser() gets a mapper and uses it to retrieve a User. Then it calls JUnit's method assertEquals to check that the returned data is what was expected: 40 | {{{ 41 | @Test 42 | public void shouldGetAUser() { 43 | SqlSession sqlSession = sqlSessionFactory.openSession(); 44 | try { 45 | Mapper mapper = sqlSession.getMapper(Mapper.class); 46 | User user = mapper.getUser(1); 47 | Assert.assertEquals("User1", user.getName()); 48 | } finally { 49 | sqlSession.close(); 50 | } 51 | } 52 | }}} 53 | 54 | = Code your own Test = 55 | 56 | Taking base test as a basis these are the modifications you should do to build your own test: 57 | * Change package name from org.apache.ibatis.submitted.basetest to org.apache.ibatis.submitted.xxx where xxx is your test name 58 | * Note that you should also change String literals that hold the package in !BaseTest#setUp (twice), in mybatis-config and in Mapper.xml. 59 | * Change database name both in !BaseTest and mybatis-config.xml from jdbc:hsqldb:mem:basetest to jdbc:hsqldb:mem:xxx where xxx is your test name. 60 | * Run the test. It should finish OK. 61 | * Add your own code. 62 | * Once you are done, create a patch with all your changes (including the test) and attach it to an issue. -------------------------------------------------------------------------------- /wiki/ResultHandlerExample.wiki: -------------------------------------------------------------------------------- 1 | #summary Handle results from complex queries 2 | #labels Phase-Implementation 3 | 4 | = Introduction = 5 | 6 | Some SQL queries return complex information that cannot be described by simple XML or annotations. 7 | For this special case, MyBatis has a ResultHandler interface that gives you great control over the ResultSet returned by the SQL query. 8 | 9 | 10 | == ResultHandler example == 11 | 12 | MyBatis can populate beans before calling ResultHandler's only method: handleResult(ResultContext). 13 | First, let's define a complex object that MyBatis will populate. 14 | 15 | {{{ 16 | public interface GrandFatherMapper { 17 | public static class GrandFatherWithGrandChildren { 18 | public GrandFather grandFather; 19 | public Child child; 20 | } 21 | public void selectComplex(ResultHandler handler); 22 | } 23 | }}} 24 | 25 | Then we will create a resultMap and a select that will use that object. 26 | 27 | {{{ 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | }}} 47 | 48 | Finally, let's call that select with a ResultHandler to obtain a Map of grand fathers and their childrens. 49 | 50 | {{{ 51 | public Map> selectGrandFathersWithChildren() { 52 | SqlSession sqlSession = sqlSessionFactory.openSession(); 53 | try { 54 | class MyResultHandler implements ResultHandler { 55 | Map> grandFatherWithChildren = new HashMap>(); 56 | @Override 57 | public void handleResult(ResultContext context) { 58 | final GrandFatherWithGrandChildren complex = (GrandFatherWithGrandChildren)context.getResultObject(); 59 | if (!grandFatherWithChildren.containsKey(complex.grandFather)) { 60 | grandFatherWithChildren.put(complex.grandFather, new ArrayList()); 61 | } 62 | grandFatherWithChildren.get(complex.grandFather).add(complex.child); 63 | } 64 | }; 65 | MyResultHandler handler = new MyResultHandler(); 66 | GrandFatherMapper grandFatherMapper = sqlSession.getMapper(GrandFatherMapper.class); 67 | grandFatherMapper.selectComplex(handler); 68 | 69 | return handler.grandFatherWithChildren; 70 | } finally { 71 | sqlSession.close(); 72 | } 73 | } 74 | }}} -------------------------------------------------------------------------------- /wiki/FaqJapanese.wiki: -------------------------------------------------------------------------------- 1 | =FAQ : よくある質問= 2 | 3 | ===#{...} と ${...} の違いは?=== 4 | #{...} は java.sql.PreparedStatement のプレースホルダーとして扱われます。一方、${...} はステートメント生成前に単なる文字列として置換されます。SQL ステートメント中でプレースホルダーが使える場所は限られているので、この違いを理解しておくことは重要です。 5 | 例えば、テーブル名を指定するためにプレースホルダーを使用することはできません。 6 | {{{ 7 | Map parms = new HashMap(); 8 | parms.put("table", "foo"); 9 | parms.put("criteria", 37); 10 | List rows = mapper.generalSelect(parms); 11 | }}} 12 | {{{ 13 | 16 | }}} 17 | 実行時に !MyBatis が上記のコードから生成するのは、次のような PreparedStatement になります。 18 | {{{ 19 | select * from foo where col1 = ? 20 | }}} 21 | *重要*: ${...} (文字列置換)を使う場合は、SQLインジェクション攻撃への配慮を怠らないようにしてください。また、日付などの複雑な型は文字列置換では期待通りの動作にならない可能性があります。これらの理由から、可能な限り #{...} を使うようにしてください。 22 | 23 | ===LIKE 演算子を使ったクエリはどう書く?=== 24 | 二つの方法があります。最初の(そして推奨される)方法は、Java のコード中で SQL のワイルドカードを付加するというものです。例えば次のように書くことができます。 25 | {{{ 26 | String wildcardName = "%Smi%"; 27 | List names = mapper.selectLike(wildcardName); 28 | }}} 29 | {{{ 30 | 33 | }}} 34 | もう一つは、SQL の中でワイルドカードを連結する方法です。この方法は、適切にコーディングしないと SQL インジェクションが可能となるため、上記の方法に比べると安全性の面で劣ります。こちらも例を挙げておきます。 35 | {{{ 36 | String wildcardName = "Smi"; 37 | List names = mapper.selectLike(wildcardName); 38 | }}} 39 | {{{ 40 | 43 | }}} 44 | *重要*: 二番目の例では # ではなく $ を使っています。 45 | 46 | ===バッチ更新はどう書く?=== 47 | まず、単純な INSERT 文を実行するコードを書きます。 48 | {{{ 49 | 50 | insert into names (name) values (#{value}) 51 | 52 | }}} 53 | あとは Java のコードでバッチ処理を実行するだけです。 54 | {{{ 55 | List names = new ArrayList(); 56 | names.add("Fred"); 57 | names.add("Barney"); 58 | names.add("Betty"); 59 | names.add("Wilma"); 60 | 61 | SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); 62 | try { 63 | NameMapper mapper = sqlSession.getMapper(NameMapper.class); 64 | for (String name : names) { 65 | mapper.insertName(name); 66 | } 67 | sqlSession.commit(); 68 | } finally { 69 | sqlSession.close(); 70 | } 71 | }}} 72 | 73 | ===自動採番された値はどうやって取得すれば良い?=== 74 | insert メソッドは *常に* int 型の値(挿入された行数)を返します。自動採番された値は insert メソッド実行時に、引数として渡したオブジェクトに設定されます。例えば、下記のようにして取得することができます。 75 | {{{ 76 | 77 | insert into names (name) values (#{name}) 78 | 79 | }}} 80 | {{{ 81 | Name name = new Name(); 82 | name.setName("Fred"); 83 | 84 | int rows = mapper.insertName(name); 85 | System.out.println("rows inserted = " + rows); 86 | System.out.println("generated key value = " + name.getId()); 87 | }}} 88 | 89 | ===Mapper のメソッドに複数の引数を渡すには?=== 90 | Java のリフレクションではメソッドの引数名を取得することができません。この問題を回避するため、!MyBatis では引数に param1, param2... のような名前を付けています。 91 | このデフォルトの引数名が気に入らなければ、 @Param アノテーションを使って明示的に変数名を宣言することもできます。 92 | Mapper のメソッドを下記のように定義しておくと... 93 | {{{ 94 | import org.apache.ibatis.annotations.Param; 95 | public interface UserMapper { 96 | User selectUser(@Param("username") String username, @Param("hashedPassword") String hashedPassword); 97 | } 98 | }}} 99 | XML では下記のようにして引数を参照することができます。 100 | {{{ 101 | 107 | }}} -------------------------------------------------------------------------------- /wiki/FeedbackWho.wiki: -------------------------------------------------------------------------------- 1 | #summary User submitted usages of the framework. 2 | 3 | = Introduction = 4 | 5 | The following is a list of users who voluntarily listed themselves here as users of the MyBatis 3.x or iBATIS 2.x frameworks. 6 | 7 | = !MyBatis 3.x = 8 | 9 | || Indizen Technologies - Corporate projects || http://www.indizen.com (Spain) || 10 | || Abercrombie and Fitch - ecommerce || http://www.abercrombie.com (US) || 11 | || Bosch Software Innovations || http://www.bosch-si.com (German) || 12 | || Alfresco - content management || http://www.alfresco.com (UK) || 13 | || Activiti - bpm || http://www.activiti.com (UK) || 14 | 15 | = iBATIS 2.x = 16 | 17 | || 1up.com - Gaming community || http://www.1up.com || 18 | || Abebooks.com - Worlds largest online marketplace for books || http://www.abebooks.com || 19 | || !AccesStream.com - Open Source Identity and Access Management Suite || http://www.accesstream.com || 20 | || !BullionVault.com - Online gold trading || http://www.bullionvault.com || 21 | || www.druckdiskont.at - Online print portal (Web To Print) || http://www.druckdiskont.at || 22 | || Equity Market Data - Financial Data Provider || http://www.equitymarketdata.com || 23 | || Fiskars - Consumer products manufacturer || http://www.fiskars.com || 24 | || !GalMarley.com - Gold prices, facts, figures and charts || http://www.galmarley.com || 25 | || GAPay - General Agent Payment System || http://www.gapay.com. || 26 | || Ideal Financial Services || http://www.idealfsi.com || 27 | || Live Music Addicts - Concert and venue listings for the New York City area || http://www.livemusicaddicts.com/newyork/ || 28 | || !MySpace.com - A place for friends – see Feedback and Experiences || http://www.myspace.com || 29 | || Newport - !PowerSentry affiliate || http://www.newpoint.com || 30 | || Nexaweb - How Business Applications Meet the Web || http://www.nexaweb.com || 31 | || !OfficeMax Impress - Print and Document Services || http://www.officemax.com || 32 | || Pearson Inform - Decision-making support for K-12 school districts || http://www.concertinform.com || 33 | || !PowerSentry - Fiskars brand surge protectors || http://www.powersentry.com || 34 | || Scragged.com - Political commentary || http://www.scragged.com || 35 | || !TheLadders.com - Job Search Engine || http://www.theladders.com || 36 | || The Ohio State University School of Communication || http://www.comm.ohio-state.edu || 37 | || Watkins Printing Company || http://www.watkinsprinting.com/ || 38 | || Wilkinson Sword Garden Collection || http://www.wilkinsonswordgarden.com || 39 | || Wisconsin Department of Natural Resources || http://botw.dnr.state.wi.us/botw/Welcome.do || 40 | || !WomanOwned - Business Networks for Women || http://www.womanowned.com || 41 | || Workeffort - time tracking system || https://workeffort.dev.java.net/ || 42 | || Zinck-Lysbro - Gardening products || http://www.zincklysbro.dk || 43 | || Plateau Systems - Learning Management and Performance Management Systems || http://www.plateausystems.com || 44 | || Cool Advance - All software projects use IBatis as its persistence layer (both .Net and Java). Example: Shoesathome.com || http://www.cooladvance.com (Portuguese) || 45 | || FNM Group - Ferrovie Nord Milano (Railways - Italy) || http://www.fnmgroup.it (Italian) || 46 | || Telecom Italia's OpenID Provider || http://openid.alice.it (Italian) || 47 | || !TrycksaksTorget - personalised printing online || http://www.trycksakstorget.se (Swedish) || 48 | || Goom Radio backend services || http://www.goomradio.com (France - USA) || 49 | 50 | == Other Projects == 51 | 52 | || wiki.eclipse.org - Mylyn custom database issue trackers || http://wiki.eclipse.org/Mylyn/Incubator/Generic_SQL_Connector || -------------------------------------------------------------------------------- /wiki/Spring.wiki: -------------------------------------------------------------------------------- 1 | #summary An introduction to MyBatis integration with Spring 2 | 3 | == Introduction to !MyBatis-Spring == 4 | 5 | !MyBatis-Spring helps you integrate your !MyBatis code seamlessly with Spring. Using the classes in this library, Spring will load the necessary !MyBatis factory and session classes for you. This library also provides an easy way to inject !MyBatis data mappers into your service beans. Finally, !MyBatis-Spring will handle transactions and translate !MyBatis exceptions into Spring !DataAccessExceptions. 6 | 7 | == Quick Setup == 8 | 9 | To use !MyBatis with Spring you need at least two things defined in the Spring application context: an !SqlSessionFactory and at least one data mapper class. 10 | In !MyBatis-Spring, an !SqlSessionFactoryBean is used to create an !SqlSessionFactory. To configure the factory bean, put the following in the Spring XML configuration file: 11 | 12 | {{{ 13 | 14 | 15 | 16 | }}} 17 | 18 | Notice that the !SqlSessionFactory requires a !DataSource. This can be any !DataSource and should be configured just like any other Spring database connection. 19 | 20 | Assume you have a data mapper class defined like the following: 21 | 22 | {{{ 23 | public interface UserMapper { 24 | @Select("SELECT * FROM user WHERE id = #{userId}") 25 | User getUser(@Param("userId") String userId); 26 | } 27 | }}} 28 | 29 | This interface is added to Spring using a !MapperFactoryBean like the following: 30 | 31 | {{{ 32 | 33 | 34 | 35 | 36 | }}} 37 | 38 | Note that the mapper class specified must be an interface, not an actual implementation class. In this example, annotations are used to specify the SQL, but a !MyBatis mapper XML file could also be used. 39 | 40 | Once configured, you can inject mappers directly into your business/service objects in the same way you inject any other Spring bean. The !MapperFactoryBean handles creating an !SqlSession as well as closing it. If there is a Spring transaction in progress, the session will also be committed or rolled back when the transaction completes. Finally, any exceptions will be translated into Spring !DataAccessExceptions. 41 | 42 | Calling !MyBatis data methods is now only one line of code: 43 | 44 | {{{ 45 | public class FooServiceImpl implements FooService { 46 | 47 | private UserMapper userMapper; 48 | 49 | public void setUserMapper(UserMapper userMapper) { 50 | this.userMapper = userMapper; 51 | } 52 | 53 | public User doSomeBusinessStuff(String userId) { 54 | return this.userMapper.getUser(userId); 55 | } 56 | 57 | } 58 | }}} 59 | 60 | == More info? == 61 | 62 | Have a look at the full doc in 63 | http://www.mybatis.org/spring 64 | 65 | And have a look at JPetStore 6 that is built on top of !MyBatis, Spring and Stripes: 66 | http://code.google.com/p/mybatis/downloads/list?can=3&q=Product%3DSample 67 | 68 | == Installation == 69 | 70 | !MyBatis-Spring code and detailed documentation is available at the downloads section. 71 | 72 | To use the !MyBatis-Spring module, you just need to include the mybatis-spring jar file and its dependencies in the classpath. 73 | 74 | If you are using Maven just add the following dependency to your pom.xml: 75 | 76 | {{{ 77 | 78 | org.mybatis 79 | mybatis-spring 80 | 1.1.0 81 | 82 | }}} -------------------------------------------------------------------------------- /wiki/Guice.wiki: -------------------------------------------------------------------------------- 1 | #summary An introduction to MyBatis integration with Google Guice 2 | 3 | == Introduction to !MyBatis-Guice == 4 | 5 | In our daily work we've been strongly using both !MyBatis Sql Mapper and Google Guice frameworks and once noticed we'd been continuosly repeating the same code snippets in different projects, according to the DRY _don't repeat yourself principle_, we started realizing something that alleviate us the task to create our stuff. 6 | 7 | Indeed, this small library intends to create the missing perfect glue between the two popular frameworks, reducing the boilerplate and redundant code that users have to write to configure and use !MyBatis into a Google Guice context. 8 | 9 | == Quick Look == 10 | 11 | Core components are contained in the org.mybatis.guice package, providing a set of reusable Google Guice `com.google.inject.Providers` and `com.google.inject.Modules` that alleviate users the task to create !MyBatis objects. 12 | 13 | The core component of the Guice approach is represented by the org.mybatis.guice.!MyBatisModule that's able to create, through a serie of required and optional `com.google.inject.Providers`, the core !MyBatis, !SqlSessionFactory, !SqlSessionManager and the user defined Mappers. 14 | 15 | {{{ 16 | Class> dataSourceProviderClass = [...]; 17 | Class> txFactoryProviderClass = [...]; 18 | Injector injector = Guice.createInjector(new MyBatisModule() { 19 | 20 | @Override 21 | protected void initialize() { 22 | bindDataSourceProviderType(dataSourceProviderClass); 23 | bindTransactionFactoryType(txFactoryProviderClass); 24 | addMapperClass(ContactMapper.class); 25 | handleType(CustomType.class).with(CustomLongTypeHandler.class); 26 | handleType(Address.class).with(AddressTypeHandler.class); 27 | addInterceptorClass(CountUpdateInterceptor.class); 28 | addSimpleAlias(com.acme.Foo.class); 29 | addAlias("MyBar", com.acme.Bar.class); 30 | handleType(com.acme.Foo.class).with(com.acme.dao.FooHandler.class); 31 | handleType(com.acme.Bar.class).with(com.acme.dao.BarHandler.class); 32 | addMapperClass(com.acme.dao.FooMapper.class); 33 | addMapperClass(com.acme.dao.BarMapper.class); 34 | lazyLoadingEnabled(true); 35 | bindObjectFactoryType(com.acme.MyObjectFactoryProvider.class); 36 | } 37 | 38 | }); 39 | }}} 40 | 41 | Once the !MyBatis module has been set-up, clients are ready to request !MyBatis components injections. 42 | 43 | For example, users can request directly the configured Mapper interfaces: 44 | 45 | {{{ 46 | @Singleton 47 | public final class MyMappersClient { 48 | 49 | @Inject 50 | private FooMapper fooMapper; 51 | 52 | @Inject 53 | private BarMapper barMapper; 54 | 55 | // setters here 56 | 57 | @Transactional( 58 | executorType = ExecutorType.BATCH, 59 | isolationLevel = TransactionIsolationLevel.READ_UNCOMMITTED, 60 | rethrowExceptionsAs = MyCustomException.class, 61 | exceptionMessage = "Something went wrong while foobaring {0} argument" 62 | ) 63 | public void doFooBar(String arg) { 64 | this.fooMapper.doFoo(arg); 65 | this.barMapper.doBar(arg); 66 | } 67 | 68 | }}} 69 | 70 | Please refer to the reference manual to know all about !MyBatis-Guice features 71 | 72 | == Installation == 73 | 74 | Installing the !MyBatis-Guice module it is very easy, just put the mybatis-guice-3.2.jar and related dependencies in the classpath! 75 | 76 | Apache Maven users instead can easily adding the following dependency in their POMs : 77 | 78 | {{{ 79 | 80 | org.mybatis 81 | mybatis-guice 82 | 3.2 83 | 84 | }}} -------------------------------------------------------------------------------- /wiki/faq.wiki: -------------------------------------------------------------------------------- 1 | =FAQ= 2 | 3 | ===What is the difference between #{...} and ${...}?=== 4 | !MyBatis interprets #{...} as a parameter marker in a JDBC prepared statement. !MyBatis interprets ${...} as string substitution. It is important to know the difference because parameter markers cannot be used in certain places in SQL statements. 5 | For example, you cannot use a parameter marker to specify a table name. Given the following code: 6 | {{{ 7 | Map parms = new HashMap(); 8 | parms.put("table", "foo"); 9 | parms.put("criteria", 37); 10 | List rows = mapper.generalSelect(parms); 11 | }}} 12 | {{{ 13 | 16 | }}} 17 | !MyBatis will generate the following prepared statement: 18 | {{{ 19 | select * from foo where col1 = ? 20 | }}} 21 | *Important*: note that use of ${...} (string substitution) presents a risk for SQL injection attacks. Also, string substitution can be problematical for complex types like dates. For these reasons, we recommend using the #{...} form whenever possible. 22 | 23 | ===How do I code an SQL LIKE?=== 24 | There are two methods. In the first (and preferred) method, you append 25 | the SQL wildcards in your Java code. For example: 26 | {{{ 27 | String wildcardName = "%Smi%"; 28 | List names = mapper.selectLike(wildcardName); 29 | }}} 30 | {{{ 31 | 34 | }}} 35 | Another method is to concatenate the wildcards in your SQL. This method 36 | is less safe than the method above because of possible SQL injection. For example: 37 | {{{ 38 | String wildcardName = "Smi"; 39 | List names = mapper.selectLike(wildcardName); 40 | }}} 41 | {{{ 42 | 45 | }}} 46 | *Important*: Note the use of $ vs. # in the second example! 47 | 48 | ===How do I code a batch insert?=== 49 | First, code a simple insert statement like this: 50 | {{{ 51 | 52 | insert into names (name) values (#{value}) 53 | 54 | }}} 55 | Then execute a batch in Java code like this: 56 | {{{ 57 | List names = new ArrayList(); 58 | names.add("Fred"); 59 | names.add("Barney"); 60 | names.add("Betty"); 61 | names.add("Wilma"); 62 | 63 | SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); 64 | try { 65 | NameMapper mapper = sqlSession.getMapper(NameMapper.class); 66 | for (String name : names) { 67 | mapper.insertName(name); 68 | } 69 | sqlSession.commit(); 70 | } finally { 71 | sqlSession.close(); 72 | } 73 | }}} 74 | 75 | ===How can I retrieve the value of an auto generated key?=== 76 | The insert method *always* returns an int - which is the number of rows inserted. Auto generated key values are placed into the parameter object and are available after the completion of the insert method. For example: 77 | {{{ 78 | 79 | insert into names (name) values (#{name}) 80 | 81 | }}} 82 | {{{ 83 | Name name = new Name(); 84 | name.setName("Fred"); 85 | 86 | int rows = mapper.insertName(name); 87 | System.out.println("rows inserted = " + rows); 88 | System.out.println("generated key value = " + name.getId()); 89 | }}} 90 | 91 | ===How do I use multiple parameters in a mapper?=== 92 | Java reflection does not provide a way to know the name of a method parameter so !MyBatis names them by default like: param1, param2... 93 | If you want to give them a name use the @param annotation this way: 94 | {{{ 95 | import org.apache.ibatis.annotations.Param; 96 | public interface UserMapper { 97 | User selectUser(@Param("username") String username, @Param("hashedPassword") String hashedPassword); 98 | } 99 | }}} 100 | Now you can use them in your xml like follows: 101 | {{{ 102 | 108 | }}} -------------------------------------------------------------------------------- /wiki/Caches.wiki: -------------------------------------------------------------------------------- 1 | #summary 3rd party cache implementations integration 2 | 3 | = Introduction = 4 | 5 | The !MyBatis community supports as well 3rd part cache implementations, follow below which one are currently supported in the 1.0.0 release: 6 | 7 | 8 | == Ehcache == 9 | 10 | [http://ehcache.org/ Ehcache] is a widely used java distributed cache for general purpose caching, Java EE and light-weight containers. 11 | 12 | The Ehcache integration is built on top of the `ehcache-core` and comes without any Ehcache 3rd part applications. Please refeer to official Ehcache documentation if you need Ehcache [http://ehcache.org/documentation/index.html plugins]. 13 | 14 | Users that want to use Ehcache into their applications, have to download the zip bundle, decompress it and add the jars in the classpath; Apache Maven users instead can simply add in the `pom.xm`l the following dependency: 15 | 16 | {{{ 17 | 18 | ... 19 | 20 | org.mybatis.caches 21 | mybatis-ehcache 22 | x.x.x 23 | 24 | ... 25 | 26 | }}} 27 | 28 | then, just configure it in the mapper XML: 29 | 30 | {{{ 31 | 32 | 33 | 34 | 35 | ... 36 | 37 | 38 | }}} 39 | 40 | If users need to log cache operations, they can plug the Cache logging version: 41 | 42 | {{{ 43 | 44 | 45 | 46 | 47 | ... 48 | 49 | 50 | }}} 51 | 52 | Users that need to configure Ehcache through XML configuration file, have to put in the classpath the `/ehcache.xml` resource; please refeer to the official Ehcache [http://ehcache.org/documentation/configuration.html documentation] to know more details. 53 | 54 | For further info read the [http://mybatis.github.io/ehcache-cache/ manual] 55 | 56 | == Hazelcast == 57 | 58 | [http://www.hazelcast.com Hazelcast] is an open source clustering and highly scalable data distribution platform for Java. 59 | 60 | Users that want to use Hazelcast into their applications, have to download the zip bundle, decompress it and add the jars in the classpath; Apache Maven users instead can simply add in the `pom.xm`l the following dependency: 61 | 62 | {{{ 63 | 64 | ... 65 | 66 | org.mybatis.caches 67 | mybatis-hazelcast 68 | x.x.x 69 | 70 | ... 71 | 72 | }}} 73 | 74 | then, just configure it in the mapper XML: 75 | 76 | {{{ 77 | 78 | 79 | 80 | 81 | ... 82 | 83 | 84 | }}} 85 | 86 | If users need to log cache operations, they can plug the Cache logging version: 87 | 88 | {{{ 89 | 90 | 91 | 92 | 93 | ... 94 | 95 | 96 | }}} 97 | 98 | Please refer to the official Hazelcast Near Cache [http://www.hazelcast.com/documentation.jsp#MapNearCache documentation] to know more details how to configure Hazelcast as Cache. 99 | 100 | For further info read the [http://mybatis.github.io/hazelcast-cache/ manual] 101 | 102 | == OSCache == 103 | 104 | [http://www.opensymphony.com/oscache/ OSCache] is a high performances caching solution developed and maintained by [http://www.opensymphony.com/ Open Symphony] and easily integrated in !MyBatis since the iBATIS version 2.X. 105 | 106 | Users that want to use OSCache into their applications, have to download the zip bundle, decompress it and add the jars in the classpath; Apache Maven users instead can simply add in the `pom.xm` the following dependency: 107 | 108 | {{{ 109 | 110 | ... 111 | 112 | org.mybatis.caches 113 | mybatis-oscace 114 | x.x.x 115 | 116 | ... 117 | 118 | }}} 119 | 120 | then, just configure it in the mapper XML: 121 | 122 | {{{ 123 | 124 | 125 | 126 | 127 | ... 128 | 129 | 130 | }}} 131 | 132 | If users need to log cache operations, they can plug the Cache logging version: 133 | 134 | {{{ 135 | 136 | 137 | 138 | 139 | ... 140 | 141 | 142 | }}} 143 | 144 | For proper OSCache configuration please read the official [http://wiki.opensymphony.com/display/CACHE/Configuration reference] 145 | 146 | For further info read the [http://mybatis.github.io/oscache-cache/ manual] -------------------------------------------------------------------------------- /wiki/FeedbackArticles.wiki: -------------------------------------------------------------------------------- 1 | #summary Articles and books about the framework. 2 | 3 | = !MyBatis 3.x = 4 | 5 | * !MyBatis Koans: A Path to Enlightenment (Thorny Dev) 6 | o http://thornydev.blogspot.com/2012/05/mybatis-koans-path-to-enlightenment.html 7 | 8 | * Using Spring 3 with Mybatis 3 Tutorial (Anirban Chowdhury) 9 | o http://anirbanchowdhury.wordpress.com/2012/05/14/spring-mybatis-integration-part-1/ 10 | 11 | * Rai Studies - !MyBatis 3 tutorials 12 | o http://www.raistudies.com/catagory/mybatis/ 13 | 14 | * Presentation de !MyBatis (Dridi Boukelmoune) 15 | o http://blog.zenika.com/index.php?post/2012/03/28/Presentation-de-MyBatis 16 | 17 | * !MyBatis for Scala (Frank D. Martínez M.) 18 | o http://www.fdmtech.org/2011/12/mybatis-for-scala-1-0-beta-released 19 | 20 | * Loiane Groner's !MyBatis tutorials. 21 | o http://loianegroner.com/category/ibatis-mybatis/ 22 | 23 | * !MyBatis: A User Guide Companion (Thorny Dev) 24 | o http://thornydev.blogspot.com/2012/03/mybatis-user-guide-companion.html 25 | 26 | * Developing a full Web application with !MyBatis, Tomcat, MySQL and Eclipse (!IdleWorx) 27 | o http://blog.idleworx.com/2011/02/mybatis-3-tomcat-mysql-eclipse.html 28 | 29 | * Using iBatis 3.0 with Scala 30 | o http://vasilrem.com/blog/software-development/using-ibatis-3-0-with-scala/ 31 | 32 | * What is new in iBATIS 3 (IBM) 33 | o http://www.ibm.com/developerworks/java/library/os-ibatis3/index.html?ca=drs- 34 | 35 | = iBATIS 2.x = 36 | 37 | * iBATIS in Action book 38 | o iBATIS in Action 39 | 40 | * German "Java Spektrum" print magazine (issue 1/07) 41 | o iBATIS Data Mapper 42 | 43 | * Various articles and coverage at Java201.com 44 | o iBATIS Related Resources 45 | 46 | * Spring iBATIS and AOP Transactions in the project Jug Avis Web (January 2006) 47 | o http://www.jugsardegna.org/vqwiki/jsp/Wiki?action=action_view_attachment&attachment=Spring_iBatisJug28012006.pdf 48 | 49 | * Wake Up to iBATIS, the Hibernate Alternative for Spring 50 | o http://www.devx.com/Java/Article/31481 51 | 52 | * Improve persistence with Apache Derby and iBATIS, Part 1: Initial configuration, semantics, and a simple test (January 2006) 53 | o https://www6.software.ibm.com/developerworks/education/os-ad-ibatis1/ 54 | 55 | * Tired of hand coding JDBC? Use iBatis as a data mapping framework instead 56 | o http://www-128.ibm.com/developerworks/websphere/techjournal/0510_col_barcia/0510_col_barcia.html 57 | 58 | * Using the iBATIS DAO (August 2005) 59 | o http://www.onjava.com/pub/a/onjava/2005/08/10/ibatisdao.html 60 | 61 | * Running iBATIS JPetStore on WebSphere with Derby (DB2 compatible OSS DB) (May 2005) 62 | o http://db.apache.org/derby/integrate/JPetStoreWebSphere.html 63 | 64 | * Using Flex with iBatis (Apr 2005) 65 | o http://coenraets.com/viewarticle.jsp?articleId=92 (There seems to be a glitch with the blog software used on the conraets.com site that causes it to throw an exception the first time you access it through this link. If you "refresh" the exception page in your browser, the article will come up correctly.) 66 | 67 | * DB2 UDB, WebSphere, and iBATIS (Feb 2005) 68 | o http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0502cline/ 69 | 70 | * Object-Relational Mapping with SQLMaps (Feb 2005) 71 | o http://www.onjava.com/pub/a/onjava/2005/02/02/sqlmaps.html 72 | o Korean translation for this document 73 | 74 | * Pro Spring (Jan 2005) - Chapter 10, "iBATIS Integration" is also a good general introduction to iBATIS. 75 | o http://www.apress.com/book/bookDisplay.html?bID=405 76 | 77 | * iBATIS - Where have you been all my life! (Jan 2005) 78 | o http://www.j2eegeek.com/blog/2005/01/31/ibatis-where-have-you-been-all-my-life/ 79 | 80 | * iBATIS Case Study (Oct 2004) 81 | o http://www.jugsardegna.org/vqwiki/jsp/Wiki?IBatisCaseStudy 82 | 83 | = iBATIS 1.x = 84 | 85 | * Better, Faster, Lighter Java (Jun 2004) - Chapter 8, "Persistence in Spring" with iBATIS SQL Maps 86 | o http://www.onjava.com/pub/a/onjava/excerpt/BFLJava_chap8/index1.html 87 | 88 | * Struts And iBATIS - Rick Reumann's classic iBATIS and Struts lesson. Well written. 89 | o http://www.learntechnology.net/content/ibatis/ibatis_lesson1.jsp 90 | 91 | * Using iBatis SQL Maps for Java Data Access 92 | o http://www.developer.com/lang/article.php/10924_3346301_1 93 | 94 | = iBATIS.NET = 95 | 96 | * Utilizando ibatis.NET - Parte 1 - Spanish (12 July 2006 ) 97 | o http://www.itprofessionals.com.pe/home/index.php?option=com_content&task=view&id=45&Itemid=54 98 | 99 | * LearnAsp.com C# iBATIS Lesson by Mohamed Mudassair & Charles Carroll. 100 | o http://www.learnasp.com/freebook/learn/ibatis1.aspx 101 | 102 | * No coincidence, iBATIS (March 2006) 103 | o http://weblogs.asp.net/pgielens/archive/2006/03/31/441600.aspx -------------------------------------------------------------------------------- /wiki/DocIbatis2MyBatis.wiki: -------------------------------------------------------------------------------- 1 | #summary Migration Steps when Switching from iBATIS to MyBatis 2 | 3 | == Introduction == 4 | 5 | !MyBatis is a direct fork of the iBATIS code. At the time of this writing, the code is identical, but there are no 6 | known plans to continue the iBATIS project within the Apache software foundation. Therefore it is somewhat less of a 7 | fork, and more like a bend in the road. As with a corner when driving, there is a slight adjustment to be made. 8 | 9 | == Questions == 10 | 11 | * *Do I have to change my code?* 12 | 13 | No. The !MyBatis releases will be fully backward compatible. We have 14 | no intention to ever change the package name (maybe in version 4 someday). The only think that may need to be 15 | changed in the not to distant future is the DTD location. Instructions are below. Don't worry though, your 16 | code won't explode if you don't. It will just mean you can't use some of the newer features in the future until 17 | you do. 18 | 19 | * *Did the license change?* 20 | 21 | No. The copyright for future code will change. But the license is still the Apache License 2.0. 22 | 23 | * *Which versions will be supported?* 24 | 25 | iBATIS 2 and 3 will be supported, with both 2.3.5 and 3.0.1 GA releases becoming available immediately. 26 | iBATIS.NET 1.x and 3.x will be supported, with a new release coming available soon. 27 | 28 | * *What will happen to the Apache iBATIS project?* 29 | 30 | Nothing really. Apache won't delete any existing resources. They'll be available in a read-only form. 31 | The Apache project will be archived in the "Apache Attic" when it becomes stale 32 | 33 | 34 | == Steps == 35 | 36 | There are only a few simple steps to follow, some to do now, and some to do when you're ready. 37 | 38 | # Sign up for new mailing lists *(now)* 39 | # Use the new issue tracker and wiki *(now)* 40 | # Change bookmarks / links to our site *(now)* 41 | # Download new build (when you need your next build) 42 | # Change DTD/Doctype in XML Headers (at your next opportunity) 43 | 44 | === 1. Mailing Lists === 45 | 46 | First, unsubscribe from the old mailing lists by sending an email to each one that you are signed up for. 47 | 48 | Most users of the Java framework will only be signed up for the user list. 49 | 50 | * [mailto:user-java-unsubscribe@ibatis.apache.org] - Java User List 51 | * [mailto:user-cs-unsubscribe@ibatis.apache.org] - .NET User List 52 | * [mailto:dev-unsubscribe@ibatis.apache.org] - Developer List 53 | * [mailto:commits-unsubscribe@ibatis.apache.org] - Commits List 54 | 55 | There are no replacements for the developer or commits lists. Commits are easy to find with subversion or on the 56 | [http://code.google.com/p/mybatis/source/list Source/Changes] tab of the Google Projects page 57 | 58 | Now you're ready to sign up to the new !MyBatis Google Group. If you already have a Google Account, you won't 59 | have much to do... 60 | 61 | * Log into Google (GMail, YouTube, etc.) or sign up if you don't have an account. 62 | * Then join one or both of these groups: 63 | 64 | * *Java* 65 | * [http://groups.google.com/group/mybatis-user] 66 | 67 | * *.NET* 68 | * [http://groups.google.com/group/mybatisnet-user] 69 | 70 | You can leave and re-join the group any time using the same page. You can also search the group right there on the discussion 71 | page. 72 | 73 | === 2. Issue Tracking and Wiki === 74 | 75 | The Google Code project site has a new unified wiki and issue tracker. Please do not use the old Jira and Confluence 76 | wiki pages. We won't necessarily see any issues or comments posted there (recently due to an infrastructure change at the 77 | ASF, all comments were lost on Confluence pages). 78 | 79 | We've moved all of the open issues (all new featurs) for iBATIS 3 to the new Google Code issue tracker. 80 | 81 | You can find the new Issue Tracker and Wiki here: 82 | 83 | Java 84 | * [http://code.google.com/p/mybatis/issues/list Issue Tracker] 85 | * [http://code.google.com/p/mybatis/wiki/Welcome Wiki] 86 | 87 | .NET 88 | * [http://code.google.com/p/mybatisnet/issues/list Issue Tracker] 89 | * [http://code.google.com/p/mybatisnet/wiki/Welcome Wiki] 90 | 91 | 92 | === 3. Bookmarks and Links === 93 | 94 | Of course you don't want to be left with outdated or dead links. So be sure to update your browser bookmarks 95 | and any links to our site: 96 | 97 | * [http://www.mybatis.org] - Homepage 98 | * [http://code.google.com/p/mybatis/] - Java Google Code Project 99 | * [http://code.google.com/p/mybatisnet/] - .NET Google Code Project 100 | 101 | === 4. Update to the Latest Build (Java only at this time) === 102 | 103 | There's no need to do this immediately. But when you're ready to upgrade to the latest release or the 3.0 GA release 104 | of !MyBatis, you should do so from this site. There are no known plans to release any further from the Apache site. 105 | 106 | When the time comes, you'll find the new releases summarized here: 107 | 108 | * [http://mybatis.org/java.html] - software download page at mybatis.org 109 | 110 | All future releases will be distributed via Google Code and archived here: 111 | 112 | * [http://code.google.com/p/mybatis/downloads/list] - Google Code project download page 113 | 114 | For Maven users, your new dependency coordinates are: 115 | 116 | {{{ 117 | 118 | org.mybatis 119 | mybatis 120 | 3.0.1 121 | 122 | }}} 123 | 124 | === 5. Update your DTD/Doctype Headers (Java only at this time) === 125 | 126 | *After* you've updated to a build *later* than "3.0 GA Candidate", you can update your DOCTYPE headers in your Configuration and Mapper XML files. 127 | 128 | {{{ 129 | # 130 | # DOCTYPE header for MyBatis XML Configuration file. 131 | # 132 | 133 | 136 | 137 | # 138 | # DOCTYPE header for MyBatis XML Mapper files. 139 | # 140 | 141 | 144 | }}} -------------------------------------------------------------------------------- /wiki/ProcessRelease.wiki: -------------------------------------------------------------------------------- 1 | == Introduction == 2 | 3 | This page will guide the development team with setting up their environment to perform a release. 4 | 5 | 6 | == Prerequisites == 7 | 8 | * Install/Configure GPG - The artifacts that are deployed to the central maven repositories need to be signed. To do this you will need to have a public and private keypair. There is a very good [http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/ guide] that will walk you though this. 9 | 10 | * Install Maven 3 11 | 12 | == Configuration == 13 | 14 | === Maven === 15 | As of Maven 2.1.0 you can now encrypt your servers passwords. We highly recommend that you follow this [http://maven.apache.org/guides/mini/guide-encryption.html guide] to set your master password and use it to encrypt your Sonatype password in the next section. 16 | 17 | === Sonatype === 18 | Using the instructions from the previous step encrypt your Sonatype password and add the following servers to your `~/.m2/settings.xml` file. You may already have other servers in this file. If not just create the file. 19 | {{{ 20 | 21 | 22 | 23 | 24 | sonatype-nexus-snapshots 25 | nmaves 26 | {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=} 27 | 28 | 29 | 30 | sonatype-nexus-staging 31 | nmaves 32 | {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=} 33 | 34 | 35 | 36 | }}} 37 | 38 | === Google Code === 39 | Using the instructions from the previous step encrypt your Google Code password and add the following server to your `~/.m2/settings.xml` file. You may already have other servers in this file. If not just create the file. 40 | {{{ 41 | 42 | 43 | 44 | 45 | googlecode 46 | nmaves 47 | {JoOt7XAPsdYHo2uAC2p4bWN7kOVrLglffMw19Z9ETz0=} 48 | 49 | 50 | 51 | }}} 52 | 53 | === Configure the !MyBatis parent pom === 54 | If you're stared a new subproject, please use the already configured _parent pom_ to avoid replicate the same meta inf in every project: 55 | {{{ 56 | 57 | org.mybatis 58 | mybatis-parent 59 | 14 60 | 61 | }}} 62 | 63 | Even if follows below a guide that illustrates how to simplify the development, please take a look at the source code to see what has been already declared and don't invest time on something already done. 64 | 65 | The parent pom defines: 66 | 67 | * the inception year; 68 | * the organization; 69 | * the license 70 | * the issue management; 71 | * the mailing lists; 72 | * the developers list; 73 | * commons useful reporting plugins (not published, but useful during development) 74 | * commons useful build plugins (everybody agrees the compiler settings is always the same) 75 | 76 | Users that intend use the parent pom have to configure the properties below: 77 | 78 | * `findbugs.onlyAnalyze` the package name (usually followed by .`*`) under findbug analysis 79 | * `clirr.comparisonVersion` the version to compare the current code against, default value is: `${project.version}` 80 | 81 | When creating a new subproject, make sure following resources are present at same level of `src` dir: 82 | 83 | * `LICENSE` 84 | * `NOTICE` 85 | 86 | Moreover there are predefined, not active by default, profiles for a common behavior of the release process. 87 | 88 | * `docbook`: useful to generate pdf users guide, it expects `src/docbkx/index.xml` file and will produce a `${project.build.directory}/docbkx/pdf/${project.artifactId}-${project.version}-reference.pdf`; this profile can be activated using `-Pdocbook` option when launching Maven on shell; 89 | * `bundle`: it creates the 99% typical distribution `${project.build.directory}/${project.artifactId}-${project.version}-bundle.zip` package to be uploaded on MyBatis space on Google Code (requires `release` and `docbook` profiles active); this profile can be activated using `-Pbundle` option when launching Maven on shell; 90 | * `gupload`: upload the zip bundle on MyBatis space on Google Code, adding `${project.description} ${project.version} release` as summary and `Featured,Type-Archive` as labels (requires `release`, `docbook` and `bundle` profiles active); this profile can be activated using `-Pgupload` option when launching Maven on shell; 91 | 92 | To activate profiles during the release process, it is strongly suggested to configure the release plugin: 93 | {{{ 94 | 95 | 96 | 97 | org.apache.maven.plugins 98 | maven-release-plugin 99 | 100 | -Prelease,docbook,bundle,gupload 101 | 102 | 103 | 104 | 105 | }}} 106 | 107 | *NOTE* 108 | Users that have the need to customize the above behaviors can reconfigure the plugins in their POM, please don't take them as a dogma, they have been added only because they match with the 99% of the cases (see subprojects) 109 | 110 | == Release == 111 | 112 | === Release the parent pom === 113 | 114 | To release the parent pom developers have to enable the `parent-release` profile: 115 | 116 | * Prepare the release 117 | {{{ mvn release:prepare -Pparent-release }}} 118 | * Perform 119 | {{{ mvn release:perform -Pparent-release -Dgpg.passphrase=thephrase }}} 120 | 121 | or just 122 | 123 | {{{ mvn release:perform -Pparent-release }}} 124 | 125 | and type the gpg passphrase when prompted 126 | 127 | === Release a !MyBatis module === 128 | 129 | The release plugin for maven is already configured in the !MyBatis parent pom file so all you need to do is execute the following two steps to complete the release. The first step will create the release tag and update the pom with the correct release and snapshot versions. The second step will sign and deploy the artifacts to the Sonatype open source repository. This repository is synced every hour to the central Maven repositories. If you don't supply the optional gpg.passphrase then you will be prompted for it. 130 | 131 | * Prepare the release 132 | {{{ mvn release:prepare }}} 133 | * Perform 134 | {{{ mvn release:perform -Dgpg.passphrase=thephrase}}} 135 | 136 | or just 137 | 138 | {{{ mvn release:perform -Pparent-release }}} 139 | 140 | and type the gpg passphrase when prompted 141 | 142 | Now you can checkout the new release ( or just use the one left over from the release in target/checkout) and issue the following to build the artifacts for the site. 143 | 144 | {{{mvn package}}} 145 | 146 | == Managing Sonatype's Nexus == 147 | The mybatis-parent v4 is configured to work with Sonatype's Nexus to simplify the Staging Repository close and promote operation, without logging in on Nexus using the browser. 148 | First of all, add in the `~/.m2/settings.xml`the following snippet: 149 | 150 | {{{ 151 | 152 | org.sonatype.plugins 153 | 154 | }}} 155 | 156 | then in the project dir you can use the nexus goals described on the [http://www.sonatype.com/books/nexus-book/reference/staging-sect-managing-plugin.html plugin page] -------------------------------------------------------------------------------- /wiki/DocUpgrade3.wiki: -------------------------------------------------------------------------------- 1 | This page provides some information that is useful when migrating a project from iBatis 2 to !MyBatis 3. It is probably not 100% complete. 2 | 3 | The project is currently at Github https://github.com/mybatis/ibatis2mybatis 4 | 5 | = Conversion Tool = 6 | 7 | There is a tool available in the downloads section that will help you to convert your iBATIS 2.x sqlmap files into !MyBatis 3.x xml mapper files. 8 | 9 | Get it from http://mybatis.googlecode.com/files/ibatis2mybatis.zip 10 | 11 | The tool is designed around an xslt transformation and some text replacements packaged in an ant task and tries to deliver a good starting point before the more complex work begins. 12 | 13 | = New DTDs = 14 | 15 | New sqlMapConfig.xml DTD: 16 | 17 | {{{ 18 | 19 | }}} 20 | 21 | New sqlMap (`*`.map.xml) DTD: 22 | 23 | {{{ 24 | 25 | }}} 26 | 27 | = Configuration = 28 | 29 | * Root configuration tag `` is now `` 30 | 31 | == Settings == 32 | 33 | Within the root configuration tag: 34 | 35 | {{{ 36 | 37 | }}} 38 | 39 | is now: 40 | 41 | {{{ 42 | 43 | 44 | 45 | 46 | }}} 47 | 48 | and 49 | 50 | {{{ 51 | 52 | }}} 53 | 54 | can be removed, since the use of namespaces has become mandatory. 55 | 56 | == `` == 57 | 58 | `` must be moved out of the `` element to `` 59 | 60 | {{{ 61 | 62 | 63 | ... 64 | 65 | 66 | 67 | 68 | 69 | }}} 70 | 71 | == `` and `` == 72 | 73 | {{{ 74 | 75 | 76 | 77 | }}} 78 | 79 | is now: 80 | 81 | {{{ 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | }}} 91 | 92 | == `` == 93 | 94 | {{{ 95 | 96 | 97 | 98 | }}} 99 | 100 | is now: 101 | 102 | {{{ 103 | 104 | 105 | 106 | }}} 107 | 108 | 109 | = Mapping = 110 | 111 | * The root element `` is now `` 112 | * The attribute `parameterClass` should be changed to `parameterType` 113 | * The attribute `resultClass` should be changed to `resultType` 114 | * The attribute `class` should be changed to `type` 115 | * the `columnIndex` attribute does not exist anymore for the `` tag 116 | * The `groupBy` attribute has been eliminated. Here is an example of `groupBy` from a 2.x sqlMap: 117 | 118 | {{{ 119 | 120 | 121 | 122 | 123 | 124 | 125 | }}} 126 | 127 | New: 128 | 129 | {{{ 130 | 131 | 132 | 133 | 134 | 135 | 136 | }}} 137 | 138 | == Nested resultMaps == 139 | These should now be specified using the `` tag. 140 | 141 | {{{ 142 | 143 | 144 | ... 145 | 146 | }}} 147 | 148 | is now: 149 | 150 | {{{ 151 | 152 | 153 | ... 154 | 155 | }}} 156 | 157 | == `` == 158 | Although this tag is deprecated, it can be used as in iBatis 2. However for versions up to 3.0.3 there is a bug when using `type="map"` and not specifying `javaType` for a parameter. This will result in 159 | {{{ 160 | There is no getter for property named '...' in 'interface java.util.Map' 161 | }}} 162 | 163 | This should be solved in !MyBatis 3.0.4. For versions 3.0.3 and earlier the workaround is to explicitly specify `javaType`. 164 | 165 | == Inline parameters == 166 | 167 | {{{ 168 | #value# 169 | }}} 170 | 171 | is now: 172 | 173 | {{{ 174 | #{value} 175 | }}} 176 | 177 | == `jdbcType` changes == 178 | 179 | {{{ 180 | jdbcType="ORACLECURSOR" 181 | }}} 182 | 183 | is now: 184 | 185 | {{{ 186 | jdbcType="CURSOR" 187 | }}} 188 | 189 | and 190 | 191 | {{{ 192 | jdbcType="NUMBER" 193 | }}} 194 | 195 | is now: 196 | 197 | {{{ 198 | jdbcType="NUMERIC" 199 | }}} 200 | 201 | == Stored procedures == 202 | 203 | * the `` tag doesn't exist anymore. Use ` 215 | { ? = call pkgExample.getValues(p_id => ?)} 216 | 217 | }}} 218 | 219 | If you're calling an insert procedure that returns a value, you can use `