ibatis

Ibatis startBatch() only works with SqlMapClient's own start and commit transactions, not with Spring-managed ones

Hi, I'm finding that even though I have code wrapped by Spring transactions, and it commits/rolls back when I would expect, in order to make use of JDBC batching when using Ibatis and Spring I need to use explicit SqlMapClient transaction methods. I.e. this does batching as I'd expect: dao.getSqlMapClient().startTransaction(); dao.ge...

Unable to convert MySQL date/time value to System.DateTime

Hello I am using ibatis and C#. i get a result from a select query that has CreatedDate as one of the field. The Datatype of CreatedDate in Mysql is Date. I assign the result set of the select query to a Ilist< DeliveryClass>. Here the DeliveryClass CreatedDate as DateTime. When i run the application, i get Unable to convert MySQL da...

JUnit test failing - complaining of missing data that was just inserted

I have an extremely odd problem in my JUnit tests that I just can't seem to nail down. I have a multi-module java webapp project with a fairly standard structure (DAO's, service clasess, etc...). Within this project I have a 'core' project which contains some abstracted setup code which inserts a test user along with the necessary item...

iBatis how to solve a more complex N+1 problem

I have a database that is similar to the following: create table Store(storeId) create table Staff(storeId_fk, staff_id, staffName) create table Item(storeId_fk, itme_id, itemName) The Store table is large. And I have create the following java bean public class Store { List<Staff> myStaff List<Item> myItem .... } public...

java.sql.Exception ClosedConnection

I am getting the following error: java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) at ...

Logging iBatis (myBatis) events with GWT

How to turn on logging queries in GWT hosted mode? ...

Oracle XMLDB's XMLCAST and XMLQUERY incompatible with iBatis?

I've been trying to select a list of values from XMLs stored in an XMLType column but I keep getting the errors which are listed at the tail end of this post. The select id is getXMLFragment , and the relevant subset of the sqlmap.xml is as follows: <select id="getXMLFragment" resultClass="list"> SELECT ...

Is it possible to put myBatis (iBatis) xml mappers outside the project?

According to the user guide i am able to use file path instead of resource: // Using classpath relative resources <mappers> <mapper resource="org/mybatis/builder/AuthorMapper.xml"/> </mappers> // Using url fully qualified paths <mappers> <mapper url="file:///var/sqlmaps/AuthorMapper.xml"/> </mappers> in my project I'm try...

how to do Ibatis version of show sql

Is there an Ibatis setting to view the generated SQL like how Hibernate has show_sql=true? thanks ...

How to deploy axis2 + MyBatis

I am trying to do webservice (I am quite new in Webservice under java). I am using netbeans. Axis2 is having problem trying to locate the the xml configuration file for mybatis Anyone can tell me how to successfully deploy mybatis configuration. Should I manually copy the configuration under .netbeans\6.8\apache-tomcat-6.0.20_base\web...

is there a comprehensive example or tutorial for ibatis 3 with annotations?

I am specifically interested in moving away from XML-based mapper configuration to using pure Java annotations where the SQL statements often take or return complex data structures. Also, it wasn't clear in the samples I saw, how the configuration file was adapted when moving away from XML-based mappers to annotation-based Mapper interf...

how to resolve design issue in my App using Spring + iBatis

We use Spring + iBatis in all of our DAO's to fetch data from Stored Procedures. There are two main JNDI connections. one going to the datawarehouse and another going to livedb. recently lot of SPs have been moved from the livedb to the datawarehouse and vice versa. This is creating issues on the java side because: Now, each DAO d...

how to pass NULL to parameter map in iBatis

I am trying to pass null to a parameter map but I keep getting error saying: --- Check the parameter mapping for the 'something' property. How I cam calling code: HashMap myMap = new HashMap () myMap.put("something", null) getSqlMapClientTemplate().queryForList("list_of_sps.getByLastNameExactMatch", myMap ); My Mappings: <proc...

MyBatis 3.0.1 insert problem

Hi Everyone! Decided to move one of my project from iBatis to MyBatis and ran into a problem with insert. mapper xml: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt; <mapper namespace="bap.persistance.interfaces....

How To: Dynamically-defined properties in Java

Hi, How can I define some properties dynamically in Java. For now, I'm using a properties file, but I need to change these properties before installation, so these properties should be set in a file outside the jar (or install) file. These properties define my IBatis connection. Thansk in advance, Victor ...

IBatis dynamic query help

I have a table called "users" with following columns userid,name,gender,department,managerid.... I wanted to do this query but was having 2 issues 1. <> in line 4 is is causing problem, which is due to to the XML. I need to use but was not able to get things going even after some permutations. 2. the check department = 'engineering' ...

How do I go about setting up BoneCP for use in Ibatis?

I'm trying to setup iBatis to use boneCP for my JDBC. I haven't tried changing my code yet I'm just curious how I would need to go about doing it. I haven't seen any good guides on how to setup iBatis with an external JDBC. From what I have figured out: The sqlConfig xml needs to be changed. The transactionManager type needs to be chan...

How to get a sorted result in iBatis ?

I have a table mgr_employee with 2 columns managerName, teamEmployee.Although I do a sort in sql I get unsorted resultMap in java. How can I get a sorted map? Why does iBatis mix up the resultMap? <resultMap id="s_filter_defaults_ResultMap" class="java.util.HashMap"> <result property="key" column="managerName"/> <result property="v...

Dymanic Query in Ibatis

Hello All, Is it possible to pass dynamic query to Ibatis and get the record from it? E.g. I built my query using StringBuilder and at last, I got the following query "select emp_id, emp_name from employee where emp_id==1" . Now i need to pass this complete query to Ibatis and get the record. Note: Here the number of columns and wher...

null checking with iBatis-retrieved objects

I’m using iBatis with lazy-loading. I have a result map of a Person class and it has a result property, Friend, which selects another table. The problem I’m having is that, somewhere in the code I’m checking for: if(user.getFriend() == null) { //do something} But that condition is always false, even though a user which I got back has n...