ibatis

lightweight ORM instead of hibernate - robust and agile [closed]

给你一囗甜甜゛ 提交于 2019-12-03 20:15:56
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 6 years ago . i googled the phrase "lightweight ORM for j2ee" and find this page http://java-source.net/open-source/persistence from one of results. my goal is to find an ORM Framework that is lighter than Hibernate and also delivers some of hibernates features that are most important to me, for example: auto table generating and lazy initializing, and don't give me hard time

spring + ibatis 多数据源事务(分布式事务)管理配置方法(转)

ぐ巨炮叔叔 提交于 2019-12-03 18:53:24
1、我先要给大家讲一个概念:spring 的多数据源事务,这是民间的说法。官方的说法是:spring 的分布式事务。明白了这个概念,问题就好解决了。 2、分布式事务的应用场景:工程中使用两个及以上数据库中,就要考虑使用分布式事务管理,否则事务不能回滚。 3、现有两种开源的第三方jar支持spring的分布式事务管理,它们分别是:jotm和Atomikos。通过google可以找到下载的链接,其中atomikos的下载需要先填写email信息,再登录email找到链接去下载。下载地址分别: 1、 http://jotm.objectweb.org/ 2、 http://www.atomikos.com/Main/InstallingTransactionsEssentials 我使用的是jotm。 4、基于spring+ibatis的环境下配置jotm的方法很简单。只城要修改spring数据源的配置及事务的配置及可。以下是我的配置,供参考。 <bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"> <property name="defaultTimeout" value="500000"/> </bean> <bean id="dataSource" class="org.enhydra

How can I pass multiple parameters and use them?

烂漫一生 提交于 2019-12-03 16:18:23
问题 Hi I'm new to myBatis. I'm using MyBatis and Spring with mybatis-spring. How can I pass two different types of objects as parameters, and how can I use their properties in query? <update id="update" parameterType="A, B"> <!-- @@? --> UPDATE SOME WHERE x=A.x AND y=B.y <!-- @@? --> </update> 回答1: Do not specify parameterType but use @Param annotation on parameters in mapper: @Mapper public interface MyMapper { void update(@Param("a") A a, @Param("b") B b); ... } Then reference them in mapping:

java EE web开发常用框架使用感言

末鹿安然 提交于 2019-12-03 11:31:50
java EE web项目开发,从前到后... 从访问地址到处理完成转到JSP页面的转向方式: Struts:采用XML配置文件方式,路径配置集中。 Spring MVC:采用标记注入和return页面方式,路径配置分散在每个java文件中。 从对比中,我觉得Spring的这种方式存在难于集中维护项目路径的缺憾。而Struts这种方式,我们就可以很方便集中的管理项目的路径。如果项目已经很庞大,路径很多,我们现在还要在这个项目上做新东西,继续加新路径来完成新业务的访问。在Struts中,我们就可以很方便的通过查看仅有的那几个XML配置文件来确定我们要新加的路径是否和已有的存在冲突、重复等。而spring在这时就显得很悲剧了,路径分散在各个controller java文件中,你要怎么去确定呢,难道一个一个打开去看它们占有的路径? 这时你可以说,可以用eclipse来查所有的controller吖,也很简单就能确定是否和已有路径冲突。当然这样的思路可以解决大部分问题,但不是全部。首先,spring的@RequestMapping 路径定义标签是可以作用于类,也可以作用于方法的,且都允许“/”路径符号。问题随之而来,“/a/b/c/d”这样的路径,就可以分成数种写法而分开写在controller类上或类中的具体方法上,当有人把它们分段写开的时候,你还怎么来查你想定义的路径是否已经存在呢

Retreieve CLOB data using Ibatis 2.3

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to retrieve a clob data from the oracle database as shown in reports.xml .i am using oracle jdbc driver version " Oracle JDBC Driver version - 10.0.2.0.0 " . The following are the errors i receive ,kindly let me know ,how to resolve this. 2011-08-31 13:03:40,790 WARN [org.apache.struts.chain.commands.AbstractExceptionHandler] (http-10.12.230.222-8080-1) Unhandled exception com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in sa/mobily/telecop/dao/config/GenericReportQuery.xml. --- The error occurred

“Type interface is not known to the MapperRegistry” exception using mybatis

核能气质少年 提交于 2019-12-03 08:56:19
问题 I'm setting up mybatis using annotations, and getting this helpful exception org.apache.ibatis.binding.BindingException: Type interface org.foo.Bar is not known to the MapperRegistry Googling it doesn't find anything, nor the user guide. What am I missing? 回答1: just for anyone who ended up here because they're new to mybatis http://www.mybatis.org/core/configuration.html http://www.mybatis.org/mybatis-3/configuration.html in the config file mappers section <mappers> <mapper class="my.package

Log SQL queries in project using MyBatis and Spring

拜拜、爱过 提交于 2019-12-03 08:33:31
In my project i have <bean id="ABCSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="ABCDataSource" /> <property name="mapperLocations"> <list> <value>classpath:com/myco/dao/XYZMapper.xml</value> </list> </property> <bean> and log4j.logger.java.sql.Connection=debug, stdout, abclog log4j.logger.java.sql.PreparedStatement=debug, stdout, abclog log4j.logger.java.sql=debug, stdout, abclog log4j.logger.org.mybatis=debug, stdout, abclog log4j.logger.org.apache.ibatis=debug, stdout, abclog I dont see the SQL queries when i run the applicartion in log

How can I pass multiple parameters and use them?

狂风中的少年 提交于 2019-12-03 05:28:19
Hi I'm new to myBatis. I'm using MyBatis and Spring with mybatis-spring. How can I pass two different types of objects as parameters, and how can I use their properties in query? <update id="update" parameterType="A, B"> <!-- @@? --> UPDATE SOME WHERE x=A.x AND y=B.y <!-- @@? --> </update> Do not specify parameterType but use @Param annotation on parameters in mapper: @Mapper public interface MyMapper { void update(@Param("a") A a, @Param("b") B b); ... } Then reference them in mapping: <update id="update" > UPDATE SOME WHERE x=#{a.x} AND y=#{b.y} </update> Use parameterType="map" and @Param

IBatis和Hibernate区别

荒凉一梦 提交于 2019-12-03 05:27:57
1. 简介 Hibernate是当前最流行的O/R mapping框架。它出身于sf.net,现在已经成为Jboss的一部分了。iBATIS是另外一种优秀的O/R mapping框架,现已改名叫myBATIS。目前属于apache的一个子项目了。相对Hibernate"O/R"而言,iBATIS 是一种"Sql Mapping"的ORM实现。 Hibernate对数据库结构提供了较为完整的封装,Hibernate的O/R Mapping实现了POJO和数据库表之间的映射,以及SQL的自动生成和执行。程序员往往只需定义好了POJO到数据库表的映射关系,即可通过 Hibernate提供的方法完成持久层操作。 程序员甚至不需要对SQL的熟练掌握,Hibernate/OJB会根据制定的存储逻辑,自动生成对应的 SQL并调用JDBC接口加以执行。 而iBATIS的着力点,则在于POJO与SQL之间的映射关系。也就是说,iBATIS并不会为程序员在运行期自动生成SQL执行。 具体的SQL需要程 序员编写,然后通过映射配置文件,将SQL所需的参数,以及返回的结果字段映射到指定POJO。 使用iBATIS提供的ORM机制,对业务逻辑实现人员而 言,面对的是纯粹的Java对象,这一层与通过Hibernate 实现ORM而言基本一致,而对于具体的数据操作,Hibernate会自动生成SQL语句

springboot org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.dao.EmpDao.findAll 、、

假如想象 提交于 2019-12-03 04:43:21
问题原因: dao层接口和mapper里配置文件做映射绑定时出现问题 解决办法:   1.配置文件里 id="地址" 地址需要和dao层接口的方法名一致。 不一样——复制方法名修改id。    按住ctrl点击,能跳转过去。   2.service实现类上加注解:@Service 来源: https://www.cnblogs.com/ruide/p/11778116.html