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 dridi <ra...@gmail.com> on 2007/02/05 12:40:15 UTC
abator
hi,
i'm a new user of abator.
i think that you used abator before me and you can help in ùy problem.
i want to know an example of how to do the select query with abator using
"selectbyprimaykey or selectbyexample".
i used this java code
//////////////////////////////
/////
public void testBASSINSelectByPrimaryKey() {
System.out.println ("select:electByPrimaryKey");
Reader reader = null;
try {
reader = new FileReader(resource);
} catch (FileNotFoundException ex) {
}
System.out.println("***************************************");
DaoManager daoManager = DaoManagerBuilder.buildDaoManager(reader);
BASSINDAO dao = (BASSINDAO) daoManager.getDao(BASSINDAO.class);
BASSIN record = new BASSIN();
BASSIN newRecord = dao.selectByPrimaryKey("10");
Assert.assertNotNull(newRecord);
Assert.assertEquals(record.getCode_bassin(), newRecord.getCode_bassin());
Assert.assertEquals (record.getLibelle_bassin(),
newRecord.getLibelle_bassin());
}
////////////////////////////
and i have this error:
//////////////////////
Exception in thread "main" com.ibatis.dao.client.DaoException:
Failed to execute
queryForObject - id [BASSIN.abatorgenerated_selectByPrimaryKey],
parameterObject
[test.model.BASSIN@10dc6b5]. Cause:
com.ibatis.common.jdbc.exception.NestedSQLException :
--- The error occurred in test/xml/BASSIN_SqlMap.xml.
--- The error occurred while applying a result map.
--- Check the BASSIN.abatorgenerated_BASSINResult.
--- The error happened while setting a property on the result object.
--- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Can't start a cloned connection while in manual transaction mode.
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Can't start a cloned connection while in manual transaction mode.
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject
(SqlMapDaoTemplate.java:225)
at test.dao.BASSINDAOImpl.selectByPrimaryKey(BASSINDAOImpl.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:585)
at com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
at $Proxy0.selectByPrimaryKey(Unknown Source)
at abator.testBASSINSelectByPrimaryKey(abator.java:163)
at abator.main (abator.java:197)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in test/xml/BASSIN_SqlMap.xml.
--- The error occurred while applying a result map.
--- Check the BASSIN.abatorgenerated_BASSINResult.
--- The error happened while setting a property on the result object.
--- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Can't start a cloned connection while in manual transaction mode.
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Can't start a cloned connection while in manual transaction mode.
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.
executeQueryWithCallback
(GeneralStatement.java:185)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.
executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.
queryForObject
(SqlMapExecutorDelegate.java:565)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.
queryForObject(SqlMapExecutorDelegate.java:540)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.
queryForObject(SqlMapSessionImpl.java
:106)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.
queryForObject(SqlMapClientImpl.java:84)
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.
queryForObject(SqlMapDaoTemplate.java:223)
... 9 more
/////////////////////////////////////////////////////
//////////////////////////////////////////////////////
/////////////////////////
thanks,
DRIDI,
Re: abator
Posted by Jeff Butler <je...@gmail.com>.
This is not an iBATIS/Abator problem - it is related to the configuration of
your JDBC driver. See here for more information:
http://support.microsoft.com/kb/313181
Jeff Butler
On 2/5/07, dridi <ra...@gmail.com> wrote:
>
> hi,
>
> i'm a new user of abator.
> i think that you used abator before me and you can help in ùy problem.
> i want to know an example of how to do the select query with abator using
> "selectbyprimaykey or selectbyexample".
> i used this java code
> //////////////////////////////
> /////
> public void testBASSINSelectByPrimaryKey() {
> System.out.println ("select:electByPrimaryKey");
> Reader reader = null;
> try {
> reader = new FileReader(resource);
> } catch (FileNotFoundException ex) {
> }
> System.out.println("***************************************");
> DaoManager daoManager = DaoManagerBuilder.buildDaoManager(reader);
>
> BASSINDAO dao = (BASSINDAO) daoManager.getDao(BASSINDAO.class);
> BASSIN record = new BASSIN();
>
>
>
> BASSIN newRecord = dao.selectByPrimaryKey("10");
> Assert.assertNotNull(newRecord);
> Assert.assertEquals(record.getCode_bassin(),
> newRecord.getCode_bassin());
> Assert.assertEquals (record.getLibelle_bassin(),
> newRecord.getLibelle_bassin());
> }
> ////////////////////////////
> and i have this error:
> //////////////////////
>
> Exception in thread "main" com.ibatis.dao.client.DaoException:
> Failed to execute
> queryForObject - id [BASSIN.abatorgenerated_selectByPrimaryKey],
> parameterObject
> [test.model.BASSIN@10dc6b5]. Cause:
> com.ibatis.common.jdbc.exception.NestedSQLException :
> --- The error occurred in test/xml/BASSIN_SqlMap.xml.
> --- The error occurred while applying a result map.
> --- Check the BASSIN.abatorgenerated_BASSINResult.
> --- The error happened while setting a property on the result object.
> --- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]Can't start a cloned connection while in manual transaction mode.
> Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]Can't start a cloned connection while in manual transaction mode.
> at
> com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject
> (SqlMapDaoTemplate.java:225)
> at test.dao.BASSINDAOImpl.selectByPrimaryKey(BASSINDAOImpl.java:73)
> at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke (Method.java:585)
> at com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
> at $Proxy0.selectByPrimaryKey(Unknown Source)
> at abator.testBASSINSelectByPrimaryKey(abator.java:163)
> at abator.main (abator.java:197)
> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in test/xml/BASSIN_SqlMap.xml.
> --- The error occurred while applying a result map.
> --- Check the BASSIN.abatorgenerated_BASSINResult.
> --- The error happened while setting a property on the result object.
> --- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]Can't start a cloned connection while in manual transaction mode.
> Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]Can't start a cloned connection while in manual transaction mode.
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.
> executeQueryWithCallback
> (GeneralStatement.java:185)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.
> executeQueryForObject(GeneralStatement.java:104)
> at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.
> queryForObject
> (SqlMapExecutorDelegate.java:565)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.
> queryForObject(SqlMapExecutorDelegate.java:540)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.
> queryForObject(SqlMapSessionImpl.java
> :106)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.
> queryForObject(SqlMapClientImpl.java:84)
> at
> com.ibatis.dao.client.template.SqlMapDaoTemplate.
> queryForObject(SqlMapDaoTemplate.java:223)
> ... 9 more
> /////////////////////////////////////////////////////
> //////////////////////////////////////////////////////
> /////////////////////////
> thanks,
>
> DRIDI,
>
>