ibatis

How to apply a custom collation to specific columns of an SQLite database?

我与影子孤独终老i 提交于 2019-12-12 01:55:26
问题 In a C# application that uses iBATIS.NET to map data to an SQLite database I want to be able to sort specific columns by an alphabet that slightly differs from the English alphabet (there are some special characters and the order of some characters is different). I want to get from the database the results that are already sorted, because sorting in the application itself is impossible due to pagination. After some research I concluded that applying a custom collation may be the only option

PostgreSQL stored procedure using iBatis

瘦欲@ 提交于 2019-12-11 23:53:08
问题 The error occurred while applying a parameter map: --- Check the newSubs-InlineParameterMap. --- Check the statement (query failed). --- Cause: org.postgresql.util.PSQLException: ERROR: wrong record type supplied in RETURN NEXT Where: PL/pgSQL function "getnewsubs" line 34 at return next the function detail is as below.... CREATE OR REPLACE FUNCTION getnewsubs(timestamp without time zone, timestamp without time zone, integer) RETURNS SETOF record AS $BODY$declare v_fromdt alias for $1; v_todt

Mybatis 3.1中 Mapper XML 文件 的学习详解

与世无争的帅哥 提交于 2019-12-11 16:12:43
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> MyBatis 真正的力量是在映射语句中。这里是奇迹发生的地方。对于所有的力量,SQL 映射的 XML 文件是相当的简单。当然如果你将它们和对等功能的 JDBC 代码来比较,你会发现映射文件节省了大约 95%的代码量。MyBatis 的构建就是聚焦于 SQL 的,使其远离于普通的方式。 SQL 映射文件有很少的几个顶级元素(按照它们应该被定义的顺序): cache – 配置给定命名空间的缓存。 cache-ref – 从其他命名空间引用缓存配置。 resultMap – 最复杂,也是最有力量的元素,用来描述如何从数据库结果集中来加载你的对象。 parameterMap – 已经被废弃了!老式风格的参数映射。内联参数是首选,这个元素可能在将来被移除。这里不会记录。 sql – 可以重用的 SQL 块,也可以被其他语句引用。 insert – 映射插入语句 update – 映射更新语句 delete – 映射删除语句 select – 映射查询语句 下一部分将从语句本身开始来描述每个元素的细节。 select 查询语句是使用 MyBatis 时最常用的元素之一。直到你从数据库取出数据时才会发现将数据存在数据库中是多么的有价值, 所以许多应用程序查询要比更改数据多的多。对于每次插入,更新或删除,那也会有很多的查询

解决 org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found

断了今生、忘了曾经 提交于 2019-12-11 15:47:52
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 遇到这个错误,异常日志如下 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'xxxid' not found. Available parameters are [arg1, arg0, param1, param2]] with root cause org.apache.ibatis.binding.BindingException: Parameter 'xxxid' not found. Available parameters are [arg1, arg0, param1, param2] 首先判断 mybatis 参数绑定失败,执行 sql 出现异常。 可能的原因有好几个,然后排查: 1、参数名称和 xml 中参数对应 2

Using MySQL replication (Master/Slave) with MyBatis

≡放荡痞女 提交于 2019-12-11 09:06:46
问题 I am just wondering how I can use a Master/Slave MySQL replication database with MyBatis. JDBC offers a com.mysql.jdbc.ReplicationDriver (see here), but I couldn't find out where I can use similar things including all the nice properties I can configure ( roundRobinLoadBalance , autoReconnect ,...) in MyBatis. Currently I have configured my none-replicated database in MyBatis like this: <environments default="development"> <environment id="development"> <transactionManager type="JDBC" />

Does a library exist with Joda Time / iBATIS integration classes?

我怕爱的太早我们不能终老 提交于 2019-12-11 08:11:53
问题 It looks like I have to implement com.ibatis.sqlmap.client.extensions.TypeHandlerCallback for both DateTime and LocalDateTime Joda types. This isn't a big deal, but if it's implemented somewhere else I'd rather just use that. 回答1: There are no clean and flexible solutions, IMO. Jodatime dates are more flexible than the JDBC native types ( java.sql.Date , java.sql.Timestamp ...) and if you map to them you might be losing information (timezones). An "full" implementation, (perhaps bypassing the

Injecting bean in spring and mybatis configuration

旧城冷巷雨未停 提交于 2019-12-11 07:48:43
问题 I am trying to configure mybatis with spring 3. I am getting the following error Error creating bean with name 'loginController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userMapper' is defined For UserMapper interfcae I have done like this. @Service("userMapper") @Transactional public interface UserMapper { // methods here } My Controller class is @Controller @RequestMapping("/") public

iBatis using a set for a resultMap as well as a parameterMap

谁说胖子不能爱 提交于 2019-12-11 03:48:08
问题 I want to pass a Set of Strings in an iBatis query for the parameter map as well as return a collection of strings for the result set. Is this possible? Example queries ... SELECT * FROM some_table t WHERE t.some_column IN (values); UPDATE some_table t SET t.some_column = 'some_value' WHERE t.other_column IN (values); Walter 回答1: If you want to pass a List of Strings as one parameter, for example for building a IN(val1,val2...) query, then you should read about dynamic queries, in particular

MySQL like query runs extremly slow for 5000 records table

强颜欢笑 提交于 2019-12-11 02:47:24
问题 I have this issue on our production server. The application stack is, Java Web App on Tomcat 6.0.18 iBatis data access layer MySQL 5.0 database CentOS The system is deployed on virtual server having around 256 MB memory. Real problem: The query like, select * from customer executes in around 10 seconds however if the following query is executed, select * from customer where code like '%a%' right after executing the above query, the system goes into indefinite processing and ultimately forces

Handling iBatis NestedSQLException

妖精的绣舞 提交于 2019-12-10 21:17:34
问题 I have a java app that try to insert a row into the table and com.​ibatis.​common.​jdbc.​exception.NestedSQLException is thrown with the Cause com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException When I try to insert dublicate data for a unique-key constraint. How do I catch that exception? 回答1: To get to the root cause you can do something like this: try { //insert } catch (NestedSQLException e) { Throwable t = e; while(t.getCause() != null) { t = t.getCause(); } //in your