Hi,

When I used static map in dao.xml with following code, there is no problem!
dao.xml:
<dao interface="org.tri.sadam.persistence.iface.SchemaDao"
implementation="org.tri.sadam.persistence.dao.sqlserver.SQLServerSchemaDao"/
>
Java code:
  SchemaDao home = (SchemaDao)manager.getDao(SchemaDao.class);
  List list = home.getSchemaList();

However, my real case is the implementation class (e.g.
SQLServerSchemaDao,or MySQLSchemaDao) should be determined dynamically in
the java code instead of putting in static xml mapping file. But when I used
the following code:

//  SchemaDao home = (SchemaDao)manager.getDao(SchemaDao.class);
  SchemaDao home = new SQLServerSchemaDao(manager);
  List list = home.getSchemaList();

iBATIS throw the following exception. It look like DaoImpMap cannot get a
DaoImp from this  dao context. How to improve my program fix this problem?
Thanks!


java.lang.NullPointerException
at
com.ibatis.dao.engine.impl.StandardDaoManager.getTransaction(StandardDaoMana
ger.java:108)
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.getSqlMapExecutor(SqlMapDao
Template.java:60)
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTempl
ate.java:203)
at
org.tri.sadam.persistence.dao.sqlserver.SQLServerSchemaDao.getSchemaList(SQL
ServerSchemaDao.java:22)
at org.tri.sadam.test.SchemaTest.main(SchemaTest.java:37)

Reply via email to