now i tried this:


OdmLinkDAOImpl linkDao = (OdmLinkDAOImpl)daoManager.getDao(OdmLinkDAOImpl.class);

the error i get doesnt really give me a clue:

Exception in thread "main" com.ibatis.dao.client.DaoException: There is no DAO implementation found for class org.dea.odm.model.dao.test.dao.OdmLinkDAOImpl in this context. at com.ibatis.dao.engine.impl.DaoContext.getDao(DaoContext.java:75) at com.ibatis.dao.engine.impl.StandardDaoManager.getDao(StandardDaoManager.java:76) at org.dea.odm.model.dao.test.OdmLinkDAOImplTest.test(OdmLinkDAOImplTest.java:52) at org.dea.odm.model.dao.test.OdmLinkDAOImplTest.main(OdmLinkDAOImplTest.java:21)



dao.config:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE daoConfig
  PUBLIC "-//iBATIS.com//DTD DAO Configuration 2.0//EN"
  "http://www.ibatis.com/dtd/dao-2.dtd";>
<daoConfig>
<properties resource="org/dea/odm/model/dao/sqlmap/SqlMapConfig.properties" />

 <!-- Example SQL Maps DAO Configuration -->
 <context>
  <transactionManager type="SQLMAP">
<property name="SqlMapConfigResource" value="org/dea/odm/model/dao/test/sqlmap/SqlMapConfigAbator.xml"/>
  </transactionManager>

  <dao interface="org.dea.odm.model.dao.test.dao.OdmLinkDAO"

implementation="org.dea.odm.model.dao.test.dao.OdmLinkDAOImpl" />

 </context>

</daoConfig>


SqlMapConfigAbator.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
   PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
   "http://www.ibatis.com/dtd/sql-map-config-2.dtd";>
<!-- Always ensure to use the correct XML header as above! -->
<sqlMapConfig>
<properties resource="org/dea/odm/model/dao/sqlmap/SqlMapConfig.properties" /> <!-- These settings control SqlMap configuration details, primarily to do with transaction management. They are all optional (see the Developer Guide for more). -->
 <settings
   cacheModelsEnabled="true"
   enhancementEnabled="true"
   lazyLoadingEnabled="true"
   maxRequests="32"
   maxSessions="10"
   maxTransactions="5"
   useStatementNamespaces="true"
 />


  <transactionManager type="JDBC" >
   <dataSource type="SIMPLE">
     <property name="JDBC.Driver" value="${driver}"/>
     <property name="JDBC.ConnectionURL" value="${url}"/>
     <property name="JDBC.Username" value="${username}"/>
     <property name="JDBC.Password" value="${password}"/>
   </dataSource>
 </transactionManager>


<sqlMap resource="org/dea/odm/model/dao/test/sqlmap/c108272dev_ODM_LINK_SqlMap.xml" />
</sqlMapConfig>



..if i had to guess, i'd guess its something in the config files...

thanks for your patient help

t.



On Mon, 3 Jul 2006, Jeff Butler wrote:

Are you using the DAO manager to get the dao, or are you trying to create
the DAO impl class yourself?  You should have code like this somewhere:

OdmLinkDAO linkDao = daoManager.getDao(OdmLinkDAO.class);

You should NOT have this:

OdmLinkDAOImpl linkDao = new OdmLinkDAOImpl(daoManager);

Jeff Butler







On 7/3/06, Thomas Karl Schwaerzler <[EMAIL PROTECTED]>
wrote:


thanks.
indeed it was a namespace problem.
adding this line solved my problem.

but now i get another error when calling a dao method:


               OdmLinkExample ole = new OdmLinkExample();
               ole.setWorkflowId(new BigDecimal(1));

ole.setWorkflowId_Indicator(OdmLinkExample.EXAMPLE_EQUALS);
               //ole.setActionId(new BigDecimal(12));

//ole.setActionId_Indicator(OdmLinkExample.EXAMPLE_EQUALS);

               System.out.println("select:");

               // THIS LINE CAUSES THE ERROR
               linkDao.selectByExample(ole);



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:60)
       at
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(
SqlMapDaoTemplate.java:203)
       at
org.dea.odm.model.dao.test.dao.OdmLinkDAOImpl.selectByExample(
OdmLinkDAOImpl.java:59)
       at
org.dea.odm.model.dao.test.dao.OdmLinkDAOImpl.selectByExample(
OdmLinkDAOImpl.java:71)
       at
org.dea.odm.model.dao.test.OdmLinkDAOImplTest.test(OdmLinkDAOImplTest.java
:66)
       at
org.dea.odm.model.dao.test.OdmLinkDAOImplTest.main(OdmLinkDAOImplTest.java
:22)



in this method OdmLinkDAOImpl.java:

   /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table c108272dev.ODM_LINK
     *
     * @abatorgenerated Mon Jul 03 16:07:30 CEST 2006
     */
    public List selectByExample(OdmLinkExample example) {
        return selectByExample(example, null); // HERE...
    }



On Mon, 3 Jul 2006, Graeme J Sweeney wrote:

> On Mon, 3 Jul 2006, Thomas Karl Schwaerzler wrote:
>
>> com.ibatis.common.exception.NestedRuntimeException: Could not find SQL
>> statement to include with refid
>> 'user_ODM_LINK.abatorgenerated_Example_Where_Clause'
>
> Is it a namespace issue?
>
> <snip/>
>
>> here my SqlMapConfigAbator.xml
>>
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE sqlMapConfig
>>   PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
>>   "http://www.ibatis.com/dtd/sql-map-config-2.dtd";>
>> <!-- Always ensure to use the correct XML header as above! -->
>> <sqlMapConfig>
>
> Add this:
>
>  <settings useStatementNamespaces="true"/>
>
>>    <sqlMap
>>
resource="org/dea/odm/model/dao/test/sqlmap/c108272dev_ODM_LINK_SqlMap.xml"
>> />
>> </sqlMapConfig>
>
> --
> Graeme -
>


thanks
t.


Reply via email to