You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by loester <lo...@gmail.com> on 2007/05/07 16:35:21 UTC
iBatis getTransaction error
When executing the following code using MySql as a backend...
Reader reader=
Resources.getResourceAsReader("DAOMap.xml");
DaoManager daoManager =
DaoManagerBuilder.buildDaoManager(reader);
EmpDAO empDAO = new EmpDAOImpl(daoManager);
empDAO.deleteByPrimaryKey(Integer.valueOf(9000));
The following exception is thrown:
Exception in thread "main" java.lang.NullPointerException
at
com.ibatis.dao.engine.impl.StandardDaoManager.getTransaction(StandardDaoManager.java:108)
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.getSqlMapExecutor(SqlMapDaoTemplate.java:61)
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.delete(SqlMapDaoTemplate.java:185)
at dao.EmpDAOImpl.deleteByPrimaryKey(EmpDAOImpl.java:113)
at test.Test.main(Test.java:27)
Any idea on what may be the cause?
--
View this message in context: http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10358472
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: iBatis getTransaction error
Posted by loester <lo...@gmail.com>.
It works perfectly now, thanks!
Jeff Butler-2 wrote:
>
> The problem is this line:
>
> EmpDAO empDAO = new EmpDAOImpl(daoManager);
>
> When using iBATIS DAOs, you cannot create the implementation yourself. Do
> this instead:
>
> EmpDAO empDAO = (EmpDAO) daoManager.getDao(EmpDAO.class);
>
> Jeff Butler
>
>
>
> On 5/8/07, loester <lo...@gmail.com> wrote:
>>
>>
>> Here you have DAOMap.xml, SqlMapConfig.xml and the employee sql map -
>> emp_SqlMap.xml - which is generated by the Abator Eclipse plugin...
>>
>>
>> **************************** SqlMapConfig.xml ***********************
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE sqlMapConfig
>> PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
>> "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
>>
>> <sqlMapConfig>
>>
>> <settings useStatementNamespaces="true" />
>>
>>
>> <transactionManager type="JDBC">
>> <dataSource type="SIMPLE">
>> <property name="JDBC.Driver" value="
>> com.mysql.jdbc.Driver" />
>> <property name="JDBC.ConnectionURL"
>> value="jdbc:mysql://localhost:3306/ibatistutor" />
>> <property name="JDBC.Username" value="root" />
>> <property name="JDBC.Password" value="thepassword"
>> />
>> </dataSource>
>> </transactionManager>
>>
>>
>> <sqlMap resource="map/emp_SqlMap.xml" />
>>
>> </sqlMapConfig>
>>
>>
>> *****************************************************************************
>>
>> ****************************** DAOMap.xml
>> ************************************
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE daoConfig
>> PUBLIC "-//ibatis.apache.org//DTD DAO Configuration 2.0//EN"
>> "http://ibatis.apache.org/dtd/dao-2.dtd">
>>
>> <daoConfig>
>> <context>
>> <transactionManager type="SQLMAP">
>> <property name="SqlMapConfigResource" value="
>> SqlMapConfig.xml" />
>> </transactionManager>
>>
>> <dao interface="dao.EmpDAO"
>> implementation="dao.EmpDAOImpl" />
>>
>> </context>
>> </daoConfig>
>>
>> *****************************************************************************
>>
>>
>>
>>
>>
>> ***************************** emp_SqlMap.xml
>> *******************************
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
>> "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
>> <sqlMap namespace="emp" >
>> <resultMap id="abatorgenerated_EmpResult" class="model.Emp" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> <result column="empno" property="empno" jdbcType="INTEGER" />
>> <result column="ename" property="ename" jdbcType="VARCHAR" />
>> <result column="job" property="job" jdbcType="VARCHAR" />
>> <result column="mgr" property="mgr" jdbcType="INTEGER" />
>> <result column="hiredate" property="hiredate" jdbcType="TIMESTAMP" />
>> <result column="sal" property="sal" jdbcType="DOUBLE" />
>> <result column="comm" property="comm" jdbcType="DOUBLE" />
>> <result column="deptno" property="deptno" jdbcType="INTEGER" />
>> </resultMap>
>> <sql id="abatorgenerated_Example_Where_Clause" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> <dynamic prepend="where" >
>> <isPropertyAvailable prepend="and" property="AND_empno_NULL" >
>> empno is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_NULL" >
>> empno is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_NOT_NULL" >
>> empno is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_NOT_NULL" >
>> empno is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_EQUALS" >
>> empno = #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_EQUALS" >
>> empno = #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_NOT_EQUALS" >
>> empno <![CDATA[ <> ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_NOT_EQUALS" >
>> empno <![CDATA[ <> ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_GT" >
>> empno <![CDATA[ > ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_GT" >
>> empno <![CDATA[ > ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_GE" >
>> empno <![CDATA[ >= ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_GE" >
>> empno <![CDATA[ >= ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_LT" >
>> empno <![CDATA[ < ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_LT" >
>> empno <![CDATA[ < ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_empno_LE" >
>> empno <![CDATA[ <= ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_empno_LE" >
>> empno <![CDATA[ <= ]]> #empno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_NULL" >
>> ename is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_NULL" >
>> ename is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_NOT_NULL" >
>> ename is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_NOT_NULL" >
>> ename is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_EQUALS" >
>> ename = #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_EQUALS" >
>> ename = #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_NOT_EQUALS" >
>> ename <![CDATA[ <> ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_NOT_EQUALS" >
>> ename <![CDATA[ <> ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_GT" >
>> ename <![CDATA[ > ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_GT" >
>> ename <![CDATA[ > ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_GE" >
>> ename <![CDATA[ >= ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_GE" >
>> ename <![CDATA[ >= ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_LT" >
>> ename <![CDATA[ < ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_LT" >
>> ename <![CDATA[ < ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_LE" >
>> ename <![CDATA[ <= ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_LE" >
>> ename <![CDATA[ <= ]]> #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_ename_LIKE" >
>> ename like #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_ename_LIKE" >
>> ename like #ename:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_NULL" >
>> job is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_NULL" >
>> job is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_NOT_NULL" >
>> job is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_NOT_NULL" >
>> job is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_EQUALS" >
>> job = #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_EQUALS" >
>> job = #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_NOT_EQUALS" >
>> job <![CDATA[ <> ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_NOT_EQUALS" >
>> job <![CDATA[ <> ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_GT" >
>> job <![CDATA[ > ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_GT" >
>> job <![CDATA[ > ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_GE" >
>> job <![CDATA[ >= ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_GE" >
>> job <![CDATA[ >= ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_LT" >
>> job <![CDATA[ < ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_LT" >
>> job <![CDATA[ < ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_LE" >
>> job <![CDATA[ <= ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_LE" >
>> job <![CDATA[ <= ]]> #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_job_LIKE" >
>> job like #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_job_LIKE" >
>> job like #job:VARCHAR#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_NULL" >
>> mgr is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_NULL" >
>> mgr is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_NOT_NULL" >
>> mgr is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_NOT_NULL" >
>> mgr is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_EQUALS" >
>> mgr = #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_EQUALS" >
>> mgr = #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_NOT_EQUALS" >
>> mgr <![CDATA[ <> ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_NOT_EQUALS" >
>> mgr <![CDATA[ <> ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_GT" >
>> mgr <![CDATA[ > ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_GT" >
>> mgr <![CDATA[ > ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_GE" >
>> mgr <![CDATA[ >= ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_GE" >
>> mgr <![CDATA[ >= ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_LT" >
>> mgr <![CDATA[ < ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_LT" >
>> mgr <![CDATA[ < ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_mgr_LE" >
>> mgr <![CDATA[ <= ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_mgr_LE" >
>> mgr <![CDATA[ <= ]]> #mgr:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_NULL" >
>> hiredate is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_NULL" >
>> hiredate is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_NOT_NULL"
>> >
>> hiredate is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_NOT_NULL" >
>> hiredate is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_EQUALS" >
>> hiredate = #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_EQUALS" >
>> hiredate = #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and"
>> property="AND_hiredate_NOT_EQUALS"
>> >
>> hiredate <![CDATA[ <> ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_NOT_EQUALS"
>> >
>> hiredate <![CDATA[ <> ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_GT" >
>> hiredate <![CDATA[ > ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_GT" >
>> hiredate <![CDATA[ > ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_GE" >
>> hiredate <![CDATA[ >= ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_GE" >
>> hiredate <![CDATA[ >= ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_LT" >
>> hiredate <![CDATA[ < ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_LT" >
>> hiredate <![CDATA[ < ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_hiredate_LE" >
>> hiredate <![CDATA[ <= ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_hiredate_LE" >
>> hiredate <![CDATA[ <= ]]> #hiredate:TIMESTAMP#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_NULL" >
>> sal is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_NULL" >
>> sal is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_NOT_NULL" >
>> sal is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_NOT_NULL" >
>> sal is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_EQUALS" >
>> sal = #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_EQUALS" >
>> sal = #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_NOT_EQUALS" >
>> sal <![CDATA[ <> ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_NOT_EQUALS" >
>> sal <![CDATA[ <> ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_GT" >
>> sal <![CDATA[ > ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_GT" >
>> sal <![CDATA[ > ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_GE" >
>> sal <![CDATA[ >= ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_GE" >
>> sal <![CDATA[ >= ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_LT" >
>> sal <![CDATA[ < ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_LT" >
>> sal <![CDATA[ < ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_sal_LE" >
>> sal <![CDATA[ <= ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_sal_LE" >
>> sal <![CDATA[ <= ]]> #sal:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_NULL" >
>> comm is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_NULL" >
>> comm is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_NOT_NULL" >
>> comm is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_NOT_NULL" >
>> comm is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_EQUALS" >
>> comm = #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_EQUALS" >
>> comm = #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_NOT_EQUALS" >
>> comm <![CDATA[ <> ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_NOT_EQUALS" >
>> comm <![CDATA[ <> ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_GT" >
>> comm <![CDATA[ > ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_GT" >
>> comm <![CDATA[ > ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_GE" >
>> comm <![CDATA[ >= ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_GE" >
>> comm <![CDATA[ >= ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_LT" >
>> comm <![CDATA[ < ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_LT" >
>> comm <![CDATA[ < ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_comm_LE" >
>> comm <![CDATA[ <= ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_comm_LE" >
>> comm <![CDATA[ <= ]]> #comm:DOUBLE#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_NULL" >
>> deptno is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_NULL" >
>> deptno is null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_NOT_NULL" >
>> deptno is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_NOT_NULL" >
>> deptno is not null
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_EQUALS" >
>> deptno = #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_EQUALS" >
>> deptno = #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_NOT_EQUALS"
>> >
>> deptno <![CDATA[ <> ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_NOT_EQUALS" >
>> deptno <![CDATA[ <> ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_GT" >
>> deptno <![CDATA[ > ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_GT" >
>> deptno <![CDATA[ > ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_GE" >
>> deptno <![CDATA[ >= ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_GE" >
>> deptno <![CDATA[ >= ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_LT" >
>> deptno <![CDATA[ < ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_LT" >
>> deptno <![CDATA[ < ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="and" property="AND_deptno_LE" >
>> deptno <![CDATA[ <= ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> <isPropertyAvailable prepend="or" property="OR_deptno_LE" >
>> deptno <![CDATA[ <= ]]> #deptno:INTEGER#
>> </isPropertyAvailable>
>> </dynamic>
>> </sql>
>> <select id="abatorgenerated_selectByPrimaryKey"
>> resultMap="abatorgenerated_EmpResult" parameterClass="model.Emp" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> select empno, ename, job, mgr, hiredate, sal, comm, deptno
>> from emp
>> where empno = #empno:INTEGER#
>> </select>
>> <select id="abatorgenerated_selectByExample"
>> resultMap="abatorgenerated_EmpResult" parameterClass="java.util.Map" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> select empno, ename, job, mgr, hiredate, sal, comm, deptno
>> from emp
>> <isParameterPresent >
>> <include refid="emp.abatorgenerated_Example_Where_Clause" />
>> <isPropertyAvailable property="ABATOR_ORDER_BY_CLAUSE" >
>> order by $ABATOR_ORDER_BY_CLAUSE$
>> </isPropertyAvailable>
>> </isParameterPresent>
>> </select>
>> <delete id="abatorgenerated_deleteByPrimaryKey"
>> parameterClass="model.Emp"
>> >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> delete from emp
>> where empno = #empno:INTEGER#
>> </delete>
>> <delete id="abatorgenerated_deleteByExample"
>> parameterClass="java.util.Map" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> delete from emp
>> <include refid="emp.abatorgenerated_Example_Where_Clause" />
>> </delete>
>> <insert id="abatorgenerated_insert" parameterClass="model.Emp" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)
>> values (#empno:INTEGER#, #ename:VARCHAR#, #job:VARCHAR#,
>> #mgr:INTEGER#,
>> #hiredate:TIMESTAMP#,
>> #sal:DOUBLE#, #comm:DOUBLE#, #deptno:INTEGER#)
>> </insert>
>> <update id="abatorgenerated_updateByPrimaryKey"
>> parameterClass="model.Emp"
>> >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> update emp
>> set ename = #ename:VARCHAR#,
>> job = #job:VARCHAR#,
>> mgr = #mgr:INTEGER#,
>> hiredate = #hiredate:TIMESTAMP#,
>> sal = #sal:DOUBLE#,
>> comm = #comm:DOUBLE#,
>> deptno = #deptno:INTEGER#
>> where empno = #empno:INTEGER#
>> </update>
>> <update id="abatorgenerated_updateByPrimaryKeySelective"
>> parameterClass="model.Emp" >
>> <!--
>> WARNING - This element is automatically generated by Abator for
>> iBATIS, do not modify.
>> This element was generated on Mon May 07 15:04:12 CEST 2007.
>> -->
>> update emp
>> <dynamic prepend="set" >
>> <isNotNull prepend="," property="ename" >
>> ename = #ename:VARCHAR#
>> </isNotNull>
>> <isNotNull prepend="," property="job" >
>> job = #job:VARCHAR#
>> </isNotNull>
>> <isNotNull prepend="," property="mgr" >
>> mgr = #mgr:INTEGER#
>> </isNotNull>
>> <isNotNull prepend="," property="hiredate" >
>> hiredate = #hiredate:TIMESTAMP#
>> </isNotNull>
>> <isNotNull prepend="," property="sal" >
>> sal = #sal:DOUBLE#
>> </isNotNull>
>> <isNotNull prepend="," property="comm" >
>> comm = #comm:DOUBLE#
>> </isNotNull>
>> <isNotNull prepend="," property="deptno" >
>> deptno = #deptno:INTEGER#
>> </isNotNull>
>> </dynamic>
>> where empno = #empno#
>> </update>
>> </sqlMap>
>>
>> *****************************************************************************
>>
>>
>> Larry Meadors-2 wrote:
>> >
>> > Can you provide the DAOMap.xml, the sqlmap conig file, and the employee
>> > sql map.
>> >
>> > Larry
>> >
>> >
>> > On 5/7/07, loester <lo...@gmail.com> wrote:
>> >>
>> >> When executing the following code using MySql as a backend...
>> >>
>> >>
>> >> Reader reader=
>> >> Resources.getResourceAsReader("DAOMap.xml");
>> >> DaoManager daoManager =
>> >> DaoManagerBuilder.buildDaoManager(reader);
>> >>
>> >> EmpDAO empDAO = new EmpDAOImpl(daoManager);
>> >> empDAO.deleteByPrimaryKey(Integer.valueOf
>> (9000));
>> >>
>> >>
>> >> The following exception is thrown:
>> >>
>> >>
>> >> Exception in thread "main" java.lang.NullPointerException
>> >> at
>> >> com.ibatis.dao.engine.impl.StandardDaoManager.getTransaction(
>> StandardDaoManager.java:108)
>> >> at
>> >> com.ibatis.dao.client.template.SqlMapDaoTemplate.getSqlMapExecutor(
>> SqlMapDaoTemplate.java:61)
>> >> at
>> >> com.ibatis.dao.client.template.SqlMapDaoTemplate.delete(
>> SqlMapDaoTemplate.java:185)
>> >> at dao.EmpDAOImpl.deleteByPrimaryKey(EmpDAOImpl.java:113)
>> >> at test.Test.main(Test.java:27)
>> >>
>> >> Any idea on what may be the cause?
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10358472
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10374251
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10389350
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: iBatis getTransaction error
Posted by Jeff Butler <je...@gmail.com>.
The problem is this line:
EmpDAO empDAO = new EmpDAOImpl(daoManager);
When using iBATIS DAOs, you cannot create the implementation yourself. Do
this instead:
EmpDAO empDAO = (EmpDAO) daoManager.getDao(EmpDAO.class);
Jeff Butler
On 5/8/07, loester <lo...@gmail.com> wrote:
>
>
> Here you have DAOMap.xml, SqlMapConfig.xml and the employee sql map -
> emp_SqlMap.xml - which is generated by the Abator Eclipse plugin...
>
>
> **************************** SqlMapConfig.xml ***********************
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMapConfig
> PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
>
> <sqlMapConfig>
>
> <settings useStatementNamespaces="true" />
>
>
> <transactionManager type="JDBC">
> <dataSource type="SIMPLE">
> <property name="JDBC.Driver" value="
> com.mysql.jdbc.Driver" />
> <property name="JDBC.ConnectionURL"
> value="jdbc:mysql://localhost:3306/ibatistutor" />
> <property name="JDBC.Username" value="root" />
> <property name="JDBC.Password" value="thepassword"
> />
> </dataSource>
> </transactionManager>
>
>
> <sqlMap resource="map/emp_SqlMap.xml" />
>
> </sqlMapConfig>
>
>
> *****************************************************************************
>
> ****************************** DAOMap.xml
> ************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE daoConfig
> PUBLIC "-//ibatis.apache.org//DTD DAO Configuration 2.0//EN"
> "http://ibatis.apache.org/dtd/dao-2.dtd">
>
> <daoConfig>
> <context>
> <transactionManager type="SQLMAP">
> <property name="SqlMapConfigResource" value="
> SqlMapConfig.xml" />
> </transactionManager>
>
> <dao interface="dao.EmpDAO"
> implementation="dao.EmpDAOImpl" />
>
> </context>
> </daoConfig>
>
> *****************************************************************************
>
>
>
>
>
> ***************************** emp_SqlMap.xml
> *******************************
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
> <sqlMap namespace="emp" >
> <resultMap id="abatorgenerated_EmpResult" class="model.Emp" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> <result column="empno" property="empno" jdbcType="INTEGER" />
> <result column="ename" property="ename" jdbcType="VARCHAR" />
> <result column="job" property="job" jdbcType="VARCHAR" />
> <result column="mgr" property="mgr" jdbcType="INTEGER" />
> <result column="hiredate" property="hiredate" jdbcType="TIMESTAMP" />
> <result column="sal" property="sal" jdbcType="DOUBLE" />
> <result column="comm" property="comm" jdbcType="DOUBLE" />
> <result column="deptno" property="deptno" jdbcType="INTEGER" />
> </resultMap>
> <sql id="abatorgenerated_Example_Where_Clause" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> <dynamic prepend="where" >
> <isPropertyAvailable prepend="and" property="AND_empno_NULL" >
> empno is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_NULL" >
> empno is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_NOT_NULL" >
> empno is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_NOT_NULL" >
> empno is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_EQUALS" >
> empno = #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_EQUALS" >
> empno = #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_NOT_EQUALS" >
> empno <![CDATA[ <> ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_NOT_EQUALS" >
> empno <![CDATA[ <> ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_GT" >
> empno <![CDATA[ > ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_GT" >
> empno <![CDATA[ > ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_GE" >
> empno <![CDATA[ >= ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_GE" >
> empno <![CDATA[ >= ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_LT" >
> empno <![CDATA[ < ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_LT" >
> empno <![CDATA[ < ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_empno_LE" >
> empno <![CDATA[ <= ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_empno_LE" >
> empno <![CDATA[ <= ]]> #empno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_NULL" >
> ename is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_NULL" >
> ename is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_NOT_NULL" >
> ename is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_NOT_NULL" >
> ename is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_EQUALS" >
> ename = #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_EQUALS" >
> ename = #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_NOT_EQUALS" >
> ename <![CDATA[ <> ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_NOT_EQUALS" >
> ename <![CDATA[ <> ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_GT" >
> ename <![CDATA[ > ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_GT" >
> ename <![CDATA[ > ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_GE" >
> ename <![CDATA[ >= ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_GE" >
> ename <![CDATA[ >= ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_LT" >
> ename <![CDATA[ < ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_LT" >
> ename <![CDATA[ < ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_LE" >
> ename <![CDATA[ <= ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_LE" >
> ename <![CDATA[ <= ]]> #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_ename_LIKE" >
> ename like #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_ename_LIKE" >
> ename like #ename:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_NULL" >
> job is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_NULL" >
> job is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_NOT_NULL" >
> job is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_NOT_NULL" >
> job is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_EQUALS" >
> job = #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_EQUALS" >
> job = #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_NOT_EQUALS" >
> job <![CDATA[ <> ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_NOT_EQUALS" >
> job <![CDATA[ <> ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_GT" >
> job <![CDATA[ > ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_GT" >
> job <![CDATA[ > ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_GE" >
> job <![CDATA[ >= ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_GE" >
> job <![CDATA[ >= ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_LT" >
> job <![CDATA[ < ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_LT" >
> job <![CDATA[ < ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_LE" >
> job <![CDATA[ <= ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_LE" >
> job <![CDATA[ <= ]]> #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_job_LIKE" >
> job like #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_job_LIKE" >
> job like #job:VARCHAR#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_NULL" >
> mgr is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_NULL" >
> mgr is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_NOT_NULL" >
> mgr is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_NOT_NULL" >
> mgr is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_EQUALS" >
> mgr = #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_EQUALS" >
> mgr = #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_NOT_EQUALS" >
> mgr <![CDATA[ <> ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_NOT_EQUALS" >
> mgr <![CDATA[ <> ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_GT" >
> mgr <![CDATA[ > ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_GT" >
> mgr <![CDATA[ > ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_GE" >
> mgr <![CDATA[ >= ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_GE" >
> mgr <![CDATA[ >= ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_LT" >
> mgr <![CDATA[ < ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_LT" >
> mgr <![CDATA[ < ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_mgr_LE" >
> mgr <![CDATA[ <= ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_mgr_LE" >
> mgr <![CDATA[ <= ]]> #mgr:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_NULL" >
> hiredate is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_NULL" >
> hiredate is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_NOT_NULL" >
> hiredate is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_NOT_NULL" >
> hiredate is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_EQUALS" >
> hiredate = #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_EQUALS" >
> hiredate = #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_NOT_EQUALS"
> >
> hiredate <![CDATA[ <> ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_NOT_EQUALS" >
> hiredate <![CDATA[ <> ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_GT" >
> hiredate <![CDATA[ > ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_GT" >
> hiredate <![CDATA[ > ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_GE" >
> hiredate <![CDATA[ >= ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_GE" >
> hiredate <![CDATA[ >= ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_LT" >
> hiredate <![CDATA[ < ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_LT" >
> hiredate <![CDATA[ < ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_hiredate_LE" >
> hiredate <![CDATA[ <= ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_hiredate_LE" >
> hiredate <![CDATA[ <= ]]> #hiredate:TIMESTAMP#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_NULL" >
> sal is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_NULL" >
> sal is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_NOT_NULL" >
> sal is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_NOT_NULL" >
> sal is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_EQUALS" >
> sal = #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_EQUALS" >
> sal = #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_NOT_EQUALS" >
> sal <![CDATA[ <> ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_NOT_EQUALS" >
> sal <![CDATA[ <> ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_GT" >
> sal <![CDATA[ > ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_GT" >
> sal <![CDATA[ > ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_GE" >
> sal <![CDATA[ >= ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_GE" >
> sal <![CDATA[ >= ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_LT" >
> sal <![CDATA[ < ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_LT" >
> sal <![CDATA[ < ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_sal_LE" >
> sal <![CDATA[ <= ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_sal_LE" >
> sal <![CDATA[ <= ]]> #sal:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_NULL" >
> comm is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_NULL" >
> comm is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_NOT_NULL" >
> comm is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_NOT_NULL" >
> comm is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_EQUALS" >
> comm = #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_EQUALS" >
> comm = #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_NOT_EQUALS" >
> comm <![CDATA[ <> ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_NOT_EQUALS" >
> comm <![CDATA[ <> ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_GT" >
> comm <![CDATA[ > ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_GT" >
> comm <![CDATA[ > ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_GE" >
> comm <![CDATA[ >= ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_GE" >
> comm <![CDATA[ >= ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_LT" >
> comm <![CDATA[ < ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_LT" >
> comm <![CDATA[ < ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_comm_LE" >
> comm <![CDATA[ <= ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_comm_LE" >
> comm <![CDATA[ <= ]]> #comm:DOUBLE#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_NULL" >
> deptno is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_NULL" >
> deptno is null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_NOT_NULL" >
> deptno is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_NOT_NULL" >
> deptno is not null
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_EQUALS" >
> deptno = #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_EQUALS" >
> deptno = #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_NOT_EQUALS" >
> deptno <![CDATA[ <> ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_NOT_EQUALS" >
> deptno <![CDATA[ <> ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_GT" >
> deptno <![CDATA[ > ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_GT" >
> deptno <![CDATA[ > ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_GE" >
> deptno <![CDATA[ >= ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_GE" >
> deptno <![CDATA[ >= ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_LT" >
> deptno <![CDATA[ < ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_LT" >
> deptno <![CDATA[ < ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="and" property="AND_deptno_LE" >
> deptno <![CDATA[ <= ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> <isPropertyAvailable prepend="or" property="OR_deptno_LE" >
> deptno <![CDATA[ <= ]]> #deptno:INTEGER#
> </isPropertyAvailable>
> </dynamic>
> </sql>
> <select id="abatorgenerated_selectByPrimaryKey"
> resultMap="abatorgenerated_EmpResult" parameterClass="model.Emp" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> select empno, ename, job, mgr, hiredate, sal, comm, deptno
> from emp
> where empno = #empno:INTEGER#
> </select>
> <select id="abatorgenerated_selectByExample"
> resultMap="abatorgenerated_EmpResult" parameterClass="java.util.Map" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> select empno, ename, job, mgr, hiredate, sal, comm, deptno
> from emp
> <isParameterPresent >
> <include refid="emp.abatorgenerated_Example_Where_Clause" />
> <isPropertyAvailable property="ABATOR_ORDER_BY_CLAUSE" >
> order by $ABATOR_ORDER_BY_CLAUSE$
> </isPropertyAvailable>
> </isParameterPresent>
> </select>
> <delete id="abatorgenerated_deleteByPrimaryKey" parameterClass="model.Emp"
> >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> delete from emp
> where empno = #empno:INTEGER#
> </delete>
> <delete id="abatorgenerated_deleteByExample"
> parameterClass="java.util.Map" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> delete from emp
> <include refid="emp.abatorgenerated_Example_Where_Clause" />
> </delete>
> <insert id="abatorgenerated_insert" parameterClass="model.Emp" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)
> values (#empno:INTEGER#, #ename:VARCHAR#, #job:VARCHAR#, #mgr:INTEGER#,
> #hiredate:TIMESTAMP#,
> #sal:DOUBLE#, #comm:DOUBLE#, #deptno:INTEGER#)
> </insert>
> <update id="abatorgenerated_updateByPrimaryKey" parameterClass="model.Emp"
> >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> update emp
> set ename = #ename:VARCHAR#,
> job = #job:VARCHAR#,
> mgr = #mgr:INTEGER#,
> hiredate = #hiredate:TIMESTAMP#,
> sal = #sal:DOUBLE#,
> comm = #comm:DOUBLE#,
> deptno = #deptno:INTEGER#
> where empno = #empno:INTEGER#
> </update>
> <update id="abatorgenerated_updateByPrimaryKeySelective"
> parameterClass="model.Emp" >
> <!--
> WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
> This element was generated on Mon May 07 15:04:12 CEST 2007.
> -->
> update emp
> <dynamic prepend="set" >
> <isNotNull prepend="," property="ename" >
> ename = #ename:VARCHAR#
> </isNotNull>
> <isNotNull prepend="," property="job" >
> job = #job:VARCHAR#
> </isNotNull>
> <isNotNull prepend="," property="mgr" >
> mgr = #mgr:INTEGER#
> </isNotNull>
> <isNotNull prepend="," property="hiredate" >
> hiredate = #hiredate:TIMESTAMP#
> </isNotNull>
> <isNotNull prepend="," property="sal" >
> sal = #sal:DOUBLE#
> </isNotNull>
> <isNotNull prepend="," property="comm" >
> comm = #comm:DOUBLE#
> </isNotNull>
> <isNotNull prepend="," property="deptno" >
> deptno = #deptno:INTEGER#
> </isNotNull>
> </dynamic>
> where empno = #empno#
> </update>
> </sqlMap>
>
> *****************************************************************************
>
>
> Larry Meadors-2 wrote:
> >
> > Can you provide the DAOMap.xml, the sqlmap conig file, and the employee
> > sql map.
> >
> > Larry
> >
> >
> > On 5/7/07, loester <lo...@gmail.com> wrote:
> >>
> >> When executing the following code using MySql as a backend...
> >>
> >>
> >> Reader reader=
> >> Resources.getResourceAsReader("DAOMap.xml");
> >> DaoManager daoManager =
> >> DaoManagerBuilder.buildDaoManager(reader);
> >>
> >> EmpDAO empDAO = new EmpDAOImpl(daoManager);
> >> empDAO.deleteByPrimaryKey(Integer.valueOf
> (9000));
> >>
> >>
> >> The following exception is thrown:
> >>
> >>
> >> Exception in thread "main" java.lang.NullPointerException
> >> at
> >> com.ibatis.dao.engine.impl.StandardDaoManager.getTransaction(
> StandardDaoManager.java:108)
> >> at
> >> com.ibatis.dao.client.template.SqlMapDaoTemplate.getSqlMapExecutor(
> SqlMapDaoTemplate.java:61)
> >> at
> >> com.ibatis.dao.client.template.SqlMapDaoTemplate.delete(
> SqlMapDaoTemplate.java:185)
> >> at dao.EmpDAOImpl.deleteByPrimaryKey(EmpDAOImpl.java:113)
> >> at test.Test.main(Test.java:27)
> >>
> >> Any idea on what may be the cause?
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10358472
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10374251
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
Re: iBatis getTransaction error
Posted by loester <lo...@gmail.com>.
Here you have DAOMap.xml, SqlMapConfig.xml and the employee sql map -
emp_SqlMap.xml - which is generated by the Abator Eclipse plugin...
**************************** SqlMapConfig.xml ***********************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings useStatementNamespaces="true" />
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.mysql.jdbc.Driver" />
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost:3306/ibatistutor" />
<property name="JDBC.Username" value="root" />
<property name="JDBC.Password" value="thepassword" />
</dataSource>
</transactionManager>
<sqlMap resource="map/emp_SqlMap.xml" />
</sqlMapConfig>
*****************************************************************************
****************************** DAOMap.xml
************************************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE daoConfig
PUBLIC "-//ibatis.apache.org//DTD DAO Configuration 2.0//EN"
"http://ibatis.apache.org/dtd/dao-2.dtd">
<daoConfig>
<context>
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource" value="SqlMapConfig.xml" />
</transactionManager>
<dao interface="dao.EmpDAO"
implementation="dao.EmpDAOImpl" />
</context>
</daoConfig>
*****************************************************************************
***************************** emp_SqlMap.xml *******************************
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="emp" >
<resultMap id="abatorgenerated_EmpResult" class="model.Emp" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
<result column="empno" property="empno" jdbcType="INTEGER" />
<result column="ename" property="ename" jdbcType="VARCHAR" />
<result column="job" property="job" jdbcType="VARCHAR" />
<result column="mgr" property="mgr" jdbcType="INTEGER" />
<result column="hiredate" property="hiredate" jdbcType="TIMESTAMP" />
<result column="sal" property="sal" jdbcType="DOUBLE" />
<result column="comm" property="comm" jdbcType="DOUBLE" />
<result column="deptno" property="deptno" jdbcType="INTEGER" />
</resultMap>
<sql id="abatorgenerated_Example_Where_Clause" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
<dynamic prepend="where" >
<isPropertyAvailable prepend="and" property="AND_empno_NULL" >
empno is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_NULL" >
empno is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_NOT_NULL" >
empno is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_NOT_NULL" >
empno is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_EQUALS" >
empno = #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_EQUALS" >
empno = #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_NOT_EQUALS" >
empno <![CDATA[ <> ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_NOT_EQUALS" >
empno <![CDATA[ <> ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_GT" >
empno <![CDATA[ > ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_GT" >
empno <![CDATA[ > ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_GE" >
empno <![CDATA[ >= ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_GE" >
empno <![CDATA[ >= ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_LT" >
empno <![CDATA[ < ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_LT" >
empno <![CDATA[ < ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_empno_LE" >
empno <![CDATA[ <= ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_empno_LE" >
empno <![CDATA[ <= ]]> #empno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_NULL" >
ename is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_NULL" >
ename is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_NOT_NULL" >
ename is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_NOT_NULL" >
ename is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_EQUALS" >
ename = #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_EQUALS" >
ename = #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_NOT_EQUALS" >
ename <![CDATA[ <> ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_NOT_EQUALS" >
ename <![CDATA[ <> ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_GT" >
ename <![CDATA[ > ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_GT" >
ename <![CDATA[ > ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_GE" >
ename <![CDATA[ >= ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_GE" >
ename <![CDATA[ >= ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_LT" >
ename <![CDATA[ < ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_LT" >
ename <![CDATA[ < ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_LE" >
ename <![CDATA[ <= ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_LE" >
ename <![CDATA[ <= ]]> #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_ename_LIKE" >
ename like #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_ename_LIKE" >
ename like #ename:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_NULL" >
job is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_NULL" >
job is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_NOT_NULL" >
job is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_NOT_NULL" >
job is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_EQUALS" >
job = #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_EQUALS" >
job = #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_NOT_EQUALS" >
job <![CDATA[ <> ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_NOT_EQUALS" >
job <![CDATA[ <> ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_GT" >
job <![CDATA[ > ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_GT" >
job <![CDATA[ > ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_GE" >
job <![CDATA[ >= ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_GE" >
job <![CDATA[ >= ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_LT" >
job <![CDATA[ < ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_LT" >
job <![CDATA[ < ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_LE" >
job <![CDATA[ <= ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_LE" >
job <![CDATA[ <= ]]> #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_job_LIKE" >
job like #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_job_LIKE" >
job like #job:VARCHAR#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_NULL" >
mgr is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_NULL" >
mgr is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_NOT_NULL" >
mgr is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_NOT_NULL" >
mgr is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_EQUALS" >
mgr = #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_EQUALS" >
mgr = #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_NOT_EQUALS" >
mgr <![CDATA[ <> ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_NOT_EQUALS" >
mgr <![CDATA[ <> ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_GT" >
mgr <![CDATA[ > ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_GT" >
mgr <![CDATA[ > ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_GE" >
mgr <![CDATA[ >= ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_GE" >
mgr <![CDATA[ >= ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_LT" >
mgr <![CDATA[ < ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_LT" >
mgr <![CDATA[ < ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_mgr_LE" >
mgr <![CDATA[ <= ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_mgr_LE" >
mgr <![CDATA[ <= ]]> #mgr:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_NULL" >
hiredate is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_NULL" >
hiredate is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_NOT_NULL" >
hiredate is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_NOT_NULL" >
hiredate is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_EQUALS" >
hiredate = #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_EQUALS" >
hiredate = #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_NOT_EQUALS"
>
hiredate <![CDATA[ <> ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_NOT_EQUALS" >
hiredate <![CDATA[ <> ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_GT" >
hiredate <![CDATA[ > ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_GT" >
hiredate <![CDATA[ > ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_GE" >
hiredate <![CDATA[ >= ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_GE" >
hiredate <![CDATA[ >= ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_LT" >
hiredate <![CDATA[ < ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_LT" >
hiredate <![CDATA[ < ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_hiredate_LE" >
hiredate <![CDATA[ <= ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_hiredate_LE" >
hiredate <![CDATA[ <= ]]> #hiredate:TIMESTAMP#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_NULL" >
sal is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_NULL" >
sal is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_NOT_NULL" >
sal is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_NOT_NULL" >
sal is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_EQUALS" >
sal = #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_EQUALS" >
sal = #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_NOT_EQUALS" >
sal <![CDATA[ <> ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_NOT_EQUALS" >
sal <![CDATA[ <> ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_GT" >
sal <![CDATA[ > ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_GT" >
sal <![CDATA[ > ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_GE" >
sal <![CDATA[ >= ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_GE" >
sal <![CDATA[ >= ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_LT" >
sal <![CDATA[ < ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_LT" >
sal <![CDATA[ < ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_sal_LE" >
sal <![CDATA[ <= ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_sal_LE" >
sal <![CDATA[ <= ]]> #sal:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_NULL" >
comm is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_NULL" >
comm is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_NOT_NULL" >
comm is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_NOT_NULL" >
comm is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_EQUALS" >
comm = #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_EQUALS" >
comm = #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_NOT_EQUALS" >
comm <![CDATA[ <> ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_NOT_EQUALS" >
comm <![CDATA[ <> ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_GT" >
comm <![CDATA[ > ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_GT" >
comm <![CDATA[ > ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_GE" >
comm <![CDATA[ >= ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_GE" >
comm <![CDATA[ >= ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_LT" >
comm <![CDATA[ < ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_LT" >
comm <![CDATA[ < ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_comm_LE" >
comm <![CDATA[ <= ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_comm_LE" >
comm <![CDATA[ <= ]]> #comm:DOUBLE#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_NULL" >
deptno is null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_NULL" >
deptno is null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_NOT_NULL" >
deptno is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_NOT_NULL" >
deptno is not null
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_EQUALS" >
deptno = #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_EQUALS" >
deptno = #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_NOT_EQUALS" >
deptno <![CDATA[ <> ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_NOT_EQUALS" >
deptno <![CDATA[ <> ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_GT" >
deptno <![CDATA[ > ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_GT" >
deptno <![CDATA[ > ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_GE" >
deptno <![CDATA[ >= ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_GE" >
deptno <![CDATA[ >= ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_LT" >
deptno <![CDATA[ < ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_LT" >
deptno <![CDATA[ < ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="and" property="AND_deptno_LE" >
deptno <![CDATA[ <= ]]> #deptno:INTEGER#
</isPropertyAvailable>
<isPropertyAvailable prepend="or" property="OR_deptno_LE" >
deptno <![CDATA[ <= ]]> #deptno:INTEGER#
</isPropertyAvailable>
</dynamic>
</sql>
<select id="abatorgenerated_selectByPrimaryKey"
resultMap="abatorgenerated_EmpResult" parameterClass="model.Emp" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
select empno, ename, job, mgr, hiredate, sal, comm, deptno
from emp
where empno = #empno:INTEGER#
</select>
<select id="abatorgenerated_selectByExample"
resultMap="abatorgenerated_EmpResult" parameterClass="java.util.Map" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
select empno, ename, job, mgr, hiredate, sal, comm, deptno
from emp
<isParameterPresent >
<include refid="emp.abatorgenerated_Example_Where_Clause" />
<isPropertyAvailable property="ABATOR_ORDER_BY_CLAUSE" >
order by $ABATOR_ORDER_BY_CLAUSE$
</isPropertyAvailable>
</isParameterPresent>
</select>
<delete id="abatorgenerated_deleteByPrimaryKey" parameterClass="model.Emp"
>
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
delete from emp
where empno = #empno:INTEGER#
</delete>
<delete id="abatorgenerated_deleteByExample"
parameterClass="java.util.Map" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
delete from emp
<include refid="emp.abatorgenerated_Example_Where_Clause" />
</delete>
<insert id="abatorgenerated_insert" parameterClass="model.Emp" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (#empno:INTEGER#, #ename:VARCHAR#, #job:VARCHAR#, #mgr:INTEGER#,
#hiredate:TIMESTAMP#,
#sal:DOUBLE#, #comm:DOUBLE#, #deptno:INTEGER#)
</insert>
<update id="abatorgenerated_updateByPrimaryKey" parameterClass="model.Emp"
>
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
update emp
set ename = #ename:VARCHAR#,
job = #job:VARCHAR#,
mgr = #mgr:INTEGER#,
hiredate = #hiredate:TIMESTAMP#,
sal = #sal:DOUBLE#,
comm = #comm:DOUBLE#,
deptno = #deptno:INTEGER#
where empno = #empno:INTEGER#
</update>
<update id="abatorgenerated_updateByPrimaryKeySelective"
parameterClass="model.Emp" >
<!--
WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
This element was generated on Mon May 07 15:04:12 CEST 2007.
-->
update emp
<dynamic prepend="set" >
<isNotNull prepend="," property="ename" >
ename = #ename:VARCHAR#
</isNotNull>
<isNotNull prepend="," property="job" >
job = #job:VARCHAR#
</isNotNull>
<isNotNull prepend="," property="mgr" >
mgr = #mgr:INTEGER#
</isNotNull>
<isNotNull prepend="," property="hiredate" >
hiredate = #hiredate:TIMESTAMP#
</isNotNull>
<isNotNull prepend="," property="sal" >
sal = #sal:DOUBLE#
</isNotNull>
<isNotNull prepend="," property="comm" >
comm = #comm:DOUBLE#
</isNotNull>
<isNotNull prepend="," property="deptno" >
deptno = #deptno:INTEGER#
</isNotNull>
</dynamic>
where empno = #empno#
</update>
</sqlMap>
*****************************************************************************
Larry Meadors-2 wrote:
>
> Can you provide the DAOMap.xml, the sqlmap conig file, and the employee
> sql map.
>
> Larry
>
>
> On 5/7/07, loester <lo...@gmail.com> wrote:
>>
>> When executing the following code using MySql as a backend...
>>
>>
>> Reader reader=
>> Resources.getResourceAsReader("DAOMap.xml");
>> DaoManager daoManager =
>> DaoManagerBuilder.buildDaoManager(reader);
>>
>> EmpDAO empDAO = new EmpDAOImpl(daoManager);
>> empDAO.deleteByPrimaryKey(Integer.valueOf(9000));
>>
>>
>> The following exception is thrown:
>>
>>
>> Exception in thread "main" java.lang.NullPointerException
>> at
>> com.ibatis.dao.engine.impl.StandardDaoManager.getTransaction(StandardDaoManager.java:108)
>> at
>> com.ibatis.dao.client.template.SqlMapDaoTemplate.getSqlMapExecutor(SqlMapDaoTemplate.java:61)
>> at
>> com.ibatis.dao.client.template.SqlMapDaoTemplate.delete(SqlMapDaoTemplate.java:185)
>> at dao.EmpDAOImpl.deleteByPrimaryKey(EmpDAOImpl.java:113)
>> at test.Test.main(Test.java:27)
>>
>> Any idea on what may be the cause?
>> --
>> View this message in context:
>> http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10358472
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10374251
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: iBatis getTransaction error
Posted by Larry Meadors <lm...@apache.org>.
Can you provide the DAOMap.xml, the sqlmap conig file, and the employee sql map.
Larry
On 5/7/07, loester <lo...@gmail.com> wrote:
>
> When executing the following code using MySql as a backend...
>
>
> Reader reader=
> Resources.getResourceAsReader("DAOMap.xml");
> DaoManager daoManager =
> DaoManagerBuilder.buildDaoManager(reader);
>
> EmpDAO empDAO = new EmpDAOImpl(daoManager);
> empDAO.deleteByPrimaryKey(Integer.valueOf(9000));
>
>
> The following exception is thrown:
>
>
> Exception in thread "main" java.lang.NullPointerException
> at
> com.ibatis.dao.engine.impl.StandardDaoManager.getTransaction(StandardDaoManager.java:108)
> at
> com.ibatis.dao.client.template.SqlMapDaoTemplate.getSqlMapExecutor(SqlMapDaoTemplate.java:61)
> at
> com.ibatis.dao.client.template.SqlMapDaoTemplate.delete(SqlMapDaoTemplate.java:185)
> at dao.EmpDAOImpl.deleteByPrimaryKey(EmpDAOImpl.java:113)
> at test.Test.main(Test.java:27)
>
> Any idea on what may be the cause?
> --
> View this message in context: http://www.nabble.com/iBatis-getTransaction-error-tf3704094.html#a10358472
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>