mybatis | mybatis源码中文注释

 by   tuguangquan Java Version: mybatis-3.2.8 License: Apache-2.0

kandi X-RAY | mybatis Summary

kandi X-RAY | mybatis Summary

mybatis is a Java library typically used in Utilities applications. mybatis has build file available, it has a Permissive License and it has high support. However mybatis has 132 bugs and it has 54 vulnerabilities. You can download it from GitHub.

1.兵马未动,日志先行 org.apache.ibatis.logging org.apache.ibatis.logging.commons org.apache.ibatis.logging.jdbc org.apache.ibatis.logging.jdk14 org.apache.ibatis.logging.log4j org.apache.ibatis.logging.log4j2 org.apache.ibatis.logging.nologging org.apache.ibatis.logging.slf4j org.apache.ibatis.logging.stdout 对象适配器设计模式 设计模式可参考3.缓存 org.apache.ibatis.cache org.apache.ibatis.cache.decorators org.apache.ibatis.cache.impl. 4.解析 org.apache.ibatis.parsing xml解析,${} 格式的字符串解析 源码分析可以参考5.类型处理器 org.apache.ibatis.type 实现java和jdbc中的类型之间转换 源码分析可以参考7.反射 org.apache.ibatis.reflection org.apache.ibatis.reflection.factory org.apache.ibatis.reflection.invoker org.apache.ibatis.reflection.property org.apache.ibatis.reflection.wrapper 可以参考MetaObjectTest来跟踪调试,基本上用到了reflection包下所有的类. 8.数据源 org.apache.ibatis.datasource org.apache.ibatis.datasource.jndi org.apache.ibatis.datasource.pooled org.apache.ibatis.datasource.unpooled. 9.事务 org.apache.ibatis.transaction org.apache.ibatis.transaction.jdbc org.apache.ibatis.transaction.managed. 12.构建 org.apache.ibatis.builder org.apache.ibatis.builder.annotation org.apache.ibatis.builder.xml. 14.脚本 org.apache.ibatis.scripting org.apache.ibatis.scripting.defaults org.apache.ibatis.scripting.xmltags. 17.执行器 org.apache.ibatis.executor org.apache.ibatis.executor.keygen org.apache.ibatis.executor.loader org.apache.ibatis.executor.loader.cglib org.apache.ibatis.executor.loader.javassist org.apache.ibatis.executor.parameter org.apache.ibatis.executor.result org.apache.ibatis.executor.resultset org.apache.ibatis.executor.statement.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              mybatis has a highly active ecosystem.
              It has 4364 star(s) with 2279 fork(s). There are 210 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 7 open issues and 4 have been closed. On average issues are closed in 237 days. There are 11 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of mybatis is mybatis-3.2.8

            kandi-Quality Quality

              OutlinedDot
              mybatis has 132 bugs (19 blocker, 2 critical, 12 major, 99 minor) and 1893 code smells.

            kandi-Security Security

              OutlinedDot
              mybatis has 2 vulnerability issues reported (1 critical, 1 high, 0 medium, 0 low).
              OutlinedDot
              mybatis code analysis shows 52 unresolved vulnerabilities (52 blocker, 0 critical, 0 major, 0 minor).
              There are 6 security hotspots that need review.

            kandi-License License

              mybatis is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              mybatis releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              mybatis saves you 67496 person hours of effort in developing the same functionality from scratch.
              It has 76021 lines of code, 5188 functions and 1247 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed mybatis and discovered the below as its top functions. This is intended to give you an instant insight into mybatis implemented functionality, and help decide if they suit your requirements.
            • Handle result sets
            • Handle SELECT key annotation
            • Parse SELECT statement
            • Parse prepared statement
            • Evaluate the map expression
            • Parse an expression
            • Evaluate an EL expression
            • Invokes the proxy
            • Get parameter value string
            • Invokes the proxy method
            • Return a String representation of the data source
            • Set driver
            • Prepare statement
            • Flushes batch statements
            • Invokes the method
            • Execute an INSERT statement
            • Copies cglib
            • Compares this object with the specified object
            • Resolves the serialized object
            • Executes the UPDATE statement
            • Create a DOM Document
            • Writes this object to the specified output stream
            • Invoke the given method
            • Set parameters
            • Performs the actual update
            • Acquire proxy
            Get all kandi verified functions for this library.

            mybatis Key Features

            No Key Features are available at this moment for mybatis.

            mybatis Examples and Code Snippets

            No Code Snippets are available at this moment for mybatis.

            Community Discussions

            QUESTION

            Mybatis custom type handler doesn't work: java.lang.NoSuchMethodException: org.springframework.security.core.GrantedAuthority.()
            Asked 2021-Jun-14 at 07:50

            ** I am implementing role-based access control to my application. There are 3 users(Admin, Teacher, Student) in the application with same attribute so I created a basedUser entity to let them inherit it. I wished to get the user's authority when I select it from the database, so I created a type handler to convert the authority in String type to GrantedAuthority type in the process but I don't know why I keep getting this error: **

            nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating interface org.springframework.security.core.GrantedAuthority with invalid types () or values (). Cause: java.lang.NoSuchMethodException: org.springframework.security.core.GrantedAuthority.()] with root cause

            java.lang.NoSuchMethodException: org.springframework.security.core.GrantedAuthority.() at java.base/java.lang.Class.getConstructor0(Class.java:3349) ~[na:na] at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2553) ~[na:na] at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:60) ~[mybatis-3.5.4.jar:3.5.4] at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:53) ~[mybatis-3.5.4.jar:3.5.4] at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:45) ~[mybatis-3.5.4.jar:3.5.4] at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:616) ~[mybatis-3.5.4.jar:3.5.4] at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:591) ~[mybatis-3.5.4.jar:3.5.4]

            I have been looking for answers to this problem but not getting anywhere close, does anyone know how to solve this problem??

            Entity

            ...

            ANSWER

            Answered 2021-Jun-14 at 07:50

            Type handler is not a good fit for your usage.
            You should use constructor mapping.

            Source https://stackoverflow.com/questions/67960661

            QUESTION

            How to prevent unintended default values from MyBatis queries?
            Asked 2021-Jun-11 at 11:31

            I have the following Java class:

            ...

            ANSWER

            Answered 2021-Jun-11 at 11:31

            You are hitting the limitation of Java here so the is no elegant solution to this without the help of a 3rd party library (which is still great and I highly recommend).

            Use constructor injection and not property injection in result maps and also use lombok to automatically generate constructors for you (and/or lombok's @NonNull checks if you use Boolean).

            So if you have class:

            Source https://stackoverflow.com/questions/67784644

            QUESTION

            How can I make an SqlSessionFactory uses specific TransactionManager?
            Asked 2021-Jun-09 at 10:26

            For a set of multiple database, I successfully configured JDBC/JPA configurations.

            ...

            ANSWER

            Answered 2021-Jun-09 at 10:26

            A SqlSessionFactory will use the transaction manager associated with the Datasource. MyBatis is using Spring's native transaction management so you can configure Datasources and transaction managers as is normal in Spring. The trick is to create multiple SqlSessionFactories and associate mappers to them.

            The basic idea is to make two SqlSessionFactories and give them different names:

            Source https://stackoverflow.com/questions/67801745

            QUESTION

            How to add wildcarded mapper paths in MyBatis configuration?
            Asked 2021-Jun-03 at 15:58

            In MyBatis documentation I see only example of adding mappers by exact name.

            ...

            ANSWER

            Answered 2021-Jun-03 at 15:58

            From that same documentation page - you can register a package and all interfaces in the package will be registered. This is far less verbose than registering mappers individually:

            Source https://stackoverflow.com/questions/67801993

            QUESTION

            Error parsing SQL Mapper Configuration in mybatis
            Asked 2021-Jun-03 at 15:54

            I am using mybatis framework in a servlet and the mybatis-config.xml file is unable to find the Student_mapper class.I applied all the paths including the package name and excluding it and also used the element in my mybatis-config.xml but it doesn't work.I am still getting the same error.

            ...

            ANSWER

            Answered 2021-Jun-03 at 15:54

            The mapper class needs to be a valid Java class name. Change your mybatis-config.xml to the following:

            Source https://stackoverflow.com/questions/67823385

            QUESTION

            Mybatis and Spring Boot 2.5
            Asked 2021-May-27 at 23:48

            Will Mybatis support Spring Boot 2.5? Currently Mybatis Framework is shown as an unsupported Dependency on the Spring initializer Site for Spring Boot 2.5.0 M1 release.

            ...

            ANSWER

            Answered 2021-Feb-02 at 15:44

            Yes, it will once it reaches GA.
            'M1' means it still is a milestone release.
            See this answer for the details.

            Source https://stackoverflow.com/questions/66007248

            QUESTION

            You can't map a property that does not exist: propertyName=baseName when build using gradle 7.0
            Asked 2021-May-26 at 21:29

            Today I upgrade my Gradle version to 7.0, but when I compile the project, shows this error:

            ...

            ANSWER

            Answered 2021-May-26 at 21:29

            this is caused by too old spring-boot-gradle-plugin. It is using property which was removed in Gradle 7. I'm checking the history and you would probably need at least version 2.2.2.RELEASE.

            I believe the fix has been done as part of Gradle 6 compatibility (see Release Notes)

            I haven't tested that 2.2.2.RELEASE will fix that for sure just guessing based on code changes in the plugin. We are on 2.3.x and that works.

            Source https://stackoverflow.com/questions/67366965

            QUESTION

            spring-data-jdbc integrate with mybatis
            Asked 2021-May-21 at 12:13

            I am currently using myBatis for my project, it is good for complex SQL, but I found that I need to create many redundant SQL for basic CRUD. So I come across spring-data-jdbc (here), which is a very nice library (similar to spring-data-jpa but without JPA persistence) to help to generate CRUD SQL statement via method name.

            The guide on their official website on how to integrate with myBatis is very vague, I couldn't find any other source which showing how to do that. Basically I am looking for a way to do like below:

            ...

            ANSWER

            Answered 2021-May-21 at 12:13

            Having two separate interfaces one for repository and another for mybatis mapper is just how mybatis integration in spring-data-jdbc works as of now (version 2.2.1).

            Mapper is just an implemenation detail of the spring data repository and just should not be used by the clients, so it should not be an issue.

            What you want can be probably done but will require quite some work and might not be worth it.

            @Repository annotation instructs spring-data-jdbc to create a proxy implementing PersonRepository with all the machinery of fetching/saving objects to the database.

            @Mapper on the other hand instructs mybatis-spring to create another proxy that will handle queries from the mapping provided in xml or via annotations on the interface method.

            Only one of this proxies can be injected in the places where you are going to use PersonRepository. What you can do is to create your own proxy for PersonRepository that will create both spring-data-jdbc and mybatis proxy and will dispatch calls to them. But the complexity of this solution will be rather high compared to a simple class that delegates to two separate PersonRepository and PersonMapper.

            Update: it seems there is a way to combine mybatis mapper with repository as described in this comment https://github.com/spring-projects/spring-data-jdbc/pull/152#issuecomment-660151636

            This approach uses repository fragments to add mybatis fragment to the repository implementation.

            Source https://stackoverflow.com/questions/67634267

            QUESTION

            How to set Schema in mybatis for IRIS databse
            Asked 2021-May-20 at 17:46

            My Intersystem IRIS database contains multiple schema i.e. Each Developer has his own Schema. While accessing database from Spring boot application I am getting following error:

            ...

            ANSWER

            Answered 2021-Jan-13 at 19:32

            Unfortunately, there is no way to specify a current schema for the session. In InterSystems products supposed to use schema names all the time in all queries. And default schema for the whole system can be changed in settings.

            Source https://stackoverflow.com/questions/65681662

            QUESTION

            Populating an array in the results object with MyBatis
            Asked 2021-May-19 at 15:23

            What is the recommended approach for populating an array with values from a column in the SQL result when using MyBatis?

            I have the following code which is working but I need the response to be collapsed into a single object that contains all the appointment IDs.

            Record

            ...

            ANSWER

            Answered 2021-May-19 at 15:23

            I solved my issue by creating an XML mapper that defined a collection property in the result map:

            SiteScheduleMapper.xml

            Source https://stackoverflow.com/questions/67586974

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install mybatis

            You can download it from GitHub.
            You can use mybatis like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the mybatis component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/tuguangquan/mybatis.git

          • CLI

            gh repo clone tuguangquan/mybatis

          • sshUrl

            git@github.com:tuguangquan/mybatis.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by tuguangquan

            project

            by tuguangquanJavaScript

            reflection-proxy

            by tuguangquanJava

            WebSocket-Node

            by tuguangquanJavaScript

            N-chat

            by tuguangquanJavaScript

            springDemo

            by tuguangquanJava