ibatis

[SOLVED]Why is String " " being read as NULL when mapping from the database to an object using ibatis?

In my oracle database I have table called PERSON with columns code, surname, forename. eg. 'PER001', '________________', 'Bob' (NOTE: _ = space) surname is set to NOT NULL but you can enter in a string of spaces like " ". I am having a problem with this because when Ibatis maps this column to an Object it is mapping it as ...

How to SELECT items from from an array (IN clause details)?

I would like to do something in Java (using iBatis, JDBC, etc., really in SQL) like: SELECT SUM(rowName) FROM myTable WHERE id = [myArrayOfIds] Where myArrayOfIds can be almost any length. Now I know you can do: SELECT SUM(rowName) FROM myTable WHERE id IN (x, y, z) but what happens for longer lists? For example my list could be as...

Handling transactions spanning across database servers

I have a scenario where the unit of work is defined as: Update table T1 in database server S1 Update table T2 in database server S2 And I want the above unit of work to happen either completely or none at all (as the case with any database transaction). How can I do this? I searched extensively and found this post close to what I am e...

How to create query at runtime with iBATIS

How can I create a query at runtime using ibatis (Java)? I want the table name to be dynamic. For example I have this xml file: <resultMap id="result" class="Contact"> <result property="id" column="id"/> <result property="firstName" column="firstName"/> <result property="lastName" column="lastName"/> <result property="em...

ibatis in/out parameter problem

Can anyone tell me what's wrong? I have two procedures and two mappings for them. One works fine and another fails. This one works fine: <parameterMap id="mapping-descriptions" class="java.util.Map"> <parameter property="id" javaType="java.lang.Long" jdbcType="NUMBER" mode="IN"/> <parameter property="lang" javaType="java.l...

SQL Server statement with subselect is invalid

Hey, I am using iBATIS with SQL Server Compact Edition 3.5 and try to do a subselect INSERT INTO FORMINSTANCE (ID, ID_FORM) SELECT #ID#, f.ID FROM FORM f WHERE ID_PROCESS='10804' When I commit the transaction I get an SqlCeException (SSCE_M_QP_PARAMETERNOTALLOWED). That the Symbol '@' is on the wrong place. I think this is ...

IBatis.Net on VS 2008 first run

Examples can't be compiled. Tryed to remove NUnit references but got the error: [ConfigurationException: - The error occurred while loading SqlMap. - The error occurred in <sqlMap resource=... Tryed to create a very simple test but got the same error. It doesn't say what is the issue in my SqlMap. Couldn't find an example that reall...

How to use an IN clause in iBATIS?

I'm using iBATIS to create select statements. Now I would like to implement the following SQL statement with iBATIS: SELECT * FROM table WHERE col1 IN ('value1', 'value2'); With the following approach, the statement is not prepared correctly and no result returns: SELECT * FROM table WHERE col1 IN #listOfValues#; iBATIS seems to re...

What's the right way to handle UTC date-times using Java, iBatis, and Oracle?

I'm coming up against an unexpected daylight savings time problem in code I thought was purely UTC. I'm using Java 1.6, the iBatis SQL mapper (2.3.3), and Oracle XE (an eval version of Oracle 10.2) with the Oracle thin driver. The database contains a table that represents a television broadcast schedule. Each "Asset" (program) has a s...

converting J2EE App from Sql to Oracle - suggestions with effecient approach

We have a J2EE app built on Struts2+spring+iBatis; not all DAO's use iBatis...some code still uses the old JDBC approach of interacting with Database. All our DAO's call Stored Procedures, we do not have any inline SQL. Since Oracle Stored Procedures return cursors, we have to drastically change our code. It is fairly easy for us to c...

Spring, iBatis, MySQL - how to manage transactions?

Hello I'm building a web application with spring ibatis and mysql. I'm going to use mysql stored procedures and I will call them with ibatis. My question is about how to manage the transactions. Should I manage the transactions inside the stored procedures or with spring/ibatis or with both? ...

iBatis mapping for oracle cursor

I have the following iBatis mapping for an Oracle Stored Procedure that returns a true/false value. <resultMap id="isAuthorizedResult" class="java.lang.Boolean"> <result property="isAuthorized" column="isAuthorized"/> </resultMap> <parameterMap id="isAuthorizedCall" class="map"> <parameter property="prgType" jdbcType="Str...

iBatis 3 not backward compatible?

Does anyone know why the API is not backward compatible? Is it still thread safe? Anyone know of any migration document from 2.x to 3.x? ...

how to implement resultsetType and resultSetConcurrency in iBatis mapping

We are using Oracle. we have an old JDBC call like this... Conn.prepareCall("{call some_sp_name()}",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); usually we make the following parameter map in our mapping. <procedure id="getMax" parameterMap="getMaxCall">{call some_sp_name()}</procedure> <parameterMap id="getDebt...

spring + ibatis problem

I am getting No SqlMapClient specified error I have spring-for-ibatis.xml that has the following <bean id="MySqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="classpath:sql-map-config-oracle.xml"/> <property name="dataSource" ref="IbatisDataSourceOracle"/> </bean> ...

no SqlMapClientTemplate specified spring + ibatis

I have the following line of code in my DAO which gives error No SqlMapClient specified getSqlMapClientTemplate().queryForList("someNameSpace.procedureIdName", parm); My class is extending SqlMapClientDaoSupport I noticed in the api there is a setSqlMapClientTemplate method which takes sqlmapclienttemplate as the parameter, however, ...

ibatis 3 ispropertyavailable

It doesn't look like ispropertyavailable in the select tag is in ibatis 3. I'm moving a project from 2 to ibatis 3, is there another way to handle this scenario? ...

Unit Testing Question and iBatis

We are developing a VB.Net Thick Client. Our Business Objects get filled from Services which make calls through iBatis to the DB. These BOs obviously hold information about the object in variables. I am curious on how far to take unit testing? Do you go as far as to do create a new object, fill all of the properties and then verify that...

how to integration test a DAO built with spring + iBatis

I asked a question, title of which might have been misleading so I'm going to try to ask the question again with much detailed stuff. (i know question seems long but please bear with me) What I'm trying to do: I simply want to write a test case for my DAO and make it work. I know my DAO's work fine inside the container (app server) but...

iBatis not populating object when there are no rows found.

I am running a stored procedure that returns 2 cursors and none of them have any data. I have the following mapping xml: <resultMap id="resultMap1" class="HashMap"> <result property="firstName" columnIndex="2"/> </resultMap> <resultMap id="resultMap2" class="com.somePackage.MyBean"> <result property="unitStreetName" column="street...