ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Ski <paulsk...@hotmail.com>
Subject RE: java.lang.InstantiationException using Ibatis DAO
Date Mon, 15 Sep 2008 13:07:12 GMT


The problem was with my Ibator config file.  I changed the line from:
 
---snip---<daoGenerator targetPackage="com.intient.smash.ibatis.impl" targetProject="Smash"
type="GENERIC-CI" />---snip---
 
to:
 
---snip---<daoGenerator targetPackage="com.intient.smash.ibatis.impl" targetProject="Smash"
type="IBATIS" />---snip---
 
This caused my to generate AliasesDAOImpl with the correct constructor. E.g.:
 
---snip---
...
public class AliasesDAOImpl extends SqlMapDaoTemplate implements AliasesDAO{
 /**  * This method was generated by Abator for iBATIS. This method corresponds to the database
table aliases  * @abatorgenerated  Mon Sep 15 22:48:36 EST 2008  */ public AliasesDAOImpl
( DaoManager daoManager ) {  super ( daoManager ); }
 
...---snip---
 
Thanks,
 
Paul





From: paulski82@hotmail.comTo: user-java@ibatis.apache.orgSubject: RE: java.lang.InstantiationException
using Ibatis DAODate: Wed, 10 Sep 2008 00:54:04 +1030


Abator version is 1.1.0 for Eclipse 3.2.0 if it helps.  



Subject: RE: java.lang.InstantiationException using Ibatis DAODate: Tue, 9 Sep 2008 15:55:18
+0200From: n.beekman@wis.nlTo: user-java@ibatis.apache.org





I don’t understand. If this code is generated by Ibator, I would say that somehow you have
a version mismatch. Maybe Jeff can comment on this?
 
Niels




From: Paul Ski [mailto:paulski82@hotmail.com] Sent: Tuesday, September 09, 2008 10:20 AMTo:
user-java@ibatis.apache.orgSubject: RE: java.lang.InstantiationException using Ibatis DAO
 
package com.intient.smash.ibatis.impl;import com.ibatis.sqlmap.client.SqlMapClient;import
com.intient.smash.ibatis.Aliases;import com.intient.smash.ibatis.AliasesExample;import java.sql.SQLException;import
java.util.List;public class AliasesDAOImpl implements AliasesDAO{ /**  * This field was generated
by Abator for iBATIS. This field corresponds to the database table aliases  * @abatorgenerated
 Fri Sep 05 23:35:30 EST 2008  */ private SqlMapClient sqlMapClient; /**  * This method was
generated by Abator for iBATIS. This method corresponds to the database table aliases  * @abatorgenerated
 Fri Sep 05 23:35:30 EST 2008  */ public AliasesDAOImpl ( SqlMapClient sqlMapClient ) {  super
();  this.sqlMapClient = sqlMapClient; } /**  * This method was generated by Abator for iBATIS.
This method corresponds to the database table aliases  * @abatorgenerated  Fri Sep 05 23:35:30
EST 2008  */ public void insert ( Aliases record ) throws SQLException {  sqlMapClient.insert
( "aliases.abatorgenerated_insert", record ); } /**  * This method was generated by Abator
for iBATIS. This method corresponds to the database table aliases  * @abatorgenerated  Fri
Sep 05 23:35:30 EST 2008  */ public int updateByPrimaryKey ( Aliases record ) throws SQLException
{  int rows = sqlMapClient.update (    "aliases.abatorgenerated_updateByPrimaryKey", record
);  return rows; } /**  * This method was generated by Abator for iBATIS. This method corresponds
to the database table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public
int updateByPrimaryKeySelective ( Aliases record )   throws SQLException {  int rows = sqlMapClient.update
(    "aliases.abatorgenerated_updateByPrimaryKeySelective", record );  return rows; } /**
 * This method was generated by Abator for iBATIS. This method corresponds to the database
table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public List selectByExample
( AliasesExample example ) throws SQLException {  List list = sqlMapClient.queryForList (
   "aliases.abatorgenerated_selectByExample", example );  return list; } /**  * This method
was generated by Abator for iBATIS. This method corresponds to the database table aliases
 * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public Aliases selectByPrimaryKey (
Integer id ) throws SQLException {  Aliases key = new Aliases ();  key.setId ( id );  Aliases
record = (Aliases)sqlMapClient.queryForObject (    "aliases.abatorgenerated_selectByPrimaryKey",
key );  return record; } /**  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
 */ public int deleteByExample ( AliasesExample example ) throws SQLException {  int rows
= sqlMapClient.delete (    "aliases.abatorgenerated_deleteByExample", example );  return rows;
} /**  * This method was generated by Abator for iBATIS. This method corresponds to the database
table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public int deleteByPrimaryKey
( Integer id ) throws SQLException {  Aliases key = new Aliases ();  key.setId ( id );  int
rows = sqlMapClient.delete (    "aliases.abatorgenerated_deleteByPrimaryKey", key );  return
rows; } /**  * This method was generated by Abator for iBATIS. This method corresponds to
the database table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public int
countByExample ( AliasesExample example ) throws SQLException {  Integer count = (Integer)sqlMapClient.queryForObject
(    "aliases.abatorgenerated_countByExample", example );  return count.intValue (); } /**
 * This method was generated by Abator for iBATIS. This method corresponds to the database
table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public int updateByExampleSelective
( Aliases record, AliasesExample example )   throws SQLException {  UpdateByExampleParms parms
= new UpdateByExampleParms ( record, example );  int rows = sqlMapClient.update (    "aliases.abatorgenerated_updateByExampleSelective",
parms );  return rows; } /**  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
 */ public int updateByExample ( Aliases record, AliasesExample example )   throws SQLException
{  UpdateByExampleParms parms = new UpdateByExampleParms ( record, example );  int rows =
sqlMapClient.update (    "aliases.abatorgenerated_updateByExample", parms );  return rows;
} /**  * This class was generated by Abator for iBATIS. This class corresponds to the database
table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ private static class UpdateByExampleParms
extends AliasesExample {  private Object record;  public UpdateByExampleParms ( Object record,
AliasesExample example )  {   super ( example );   this.record = record;  }  public Object
getRecord ()  {   return record;  } }}



Subject: RE: java.lang.InstantiationException using Ibatis DAODate: Mon, 8 Sep 2008 11:37:14
+0200From: n.beekman@wis.nlTo: user-java@ibatis.apache.org

Please include the contents of com.intient.smash.ibatis.impl.AliasesDAOImpl, this has definitely
something to do with class/member visibility.




From: Paul Ski [mailto:paulski82@hotmail.com] Sent: Monday, September 08, 2008 11:31 AMTo:
user-java@ibatis.apache.orgSubject: RE: java.lang.InstantiationException using Ibatis DAO
 
com.ibatis.dao.client.DaoException: Error while configuring DaoManager.  Cause: com.ibatis.dao.client.DaoException:
Error configuring DAO.  Cause: java.lang.InstantiationException: com.intient.smash.ibatis.impl.AliasesDAOImpl
at com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(XmlDaoManagerBuilder.java:129)
at com.ibatis.dao.client.DaoManagerBuilder.buildDaoManager(DaoManagerBuilder.java:59) at com.intient.smash.DaoManagerMapper.<clinit>(DaoManagerMapper.java:17)
at com.intient.smash.TestDaoManagerMapper.<init>(TestDaoManagerMapper.java:13) at com.intient.smash.TestDaoManagerMapper.main(TestDaoManagerMapper.java:39)Caused
by: com.ibatis.dao.client.DaoException: Error configuring DAO.  Cause: java.lang.InstantiationException:
com.intient.smash.ibatis.impl.AliasesDAOImpl at com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseDao(XmlDaoManagerBuilder.java:231)
at com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseContext(XmlDaoManagerBuilder.java:160)
at com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(XmlDaoManagerBuilder.java:102)
... 4 moreCaused by: java.lang.InstantiationException: com.intient.smash.ibatis.impl.AliasesDAOImpl
at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308)
at com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseDao(XmlDaoManagerBuilder.java:225)
... 6 moreException in thread "main" java.lang.ExceptionInInitializerError at com.intient.smash.TestDaoManagerMapper.<init>(TestDaoManagerMapper.java:13)
at com.intient.smash.TestDaoManagerMapper.main(TestDaoManagerMapper.java:39)Caused by: java.lang.RuntimeException:
Could not initialize DaoManager. Cause: com.ibatis.dao.client.DaoException: Error while configuring
DaoManager.  Cause: com.ibatis.dao.client.DaoException: Error configuring DAO.  Cause: java.lang.InstantiationException:
com.intient.smash.ibatis.impl.AliasesDAOImpl at com.intient.smash.DaoManagerMapper.<clinit>(DaoManagerMapper.java:22)
... 2 more



Subject: RE: java.lang.InstantiationException using Ibatis DAODate: Mon, 8 Sep 2008 09:55:56
+0200From: n.beekman@wis.nlTo: user-java@ibatis.apache.org

Can you post the complete stacktrace?
 




From: Paul Ski [mailto:paulski82@hotmail.com] Sent: Monday, September 08, 2008 9:14 AMTo:
user-java@ibatis.apache.orgSubject: RE: java.lang.InstantiationException using Ibatis DAO
 
My DAO and DAOImlp classes were generated by Ibator.  The only generated constructor for AliasesDAOImpl
is below: ---snip--- /**  * This method was generated by Abator for iBATIS. This method corresponds
to the database table aliases  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008  */ public
AliasesDAOImpl ( SqlMapClient sqlMapClient ) {  super ();  this.sqlMapClient = sqlMapClient;
}---snip---Is there a config option for abatorConfig.xml that tells Ibator to build classes
including a constructor that takes a DaoManager object? Thanks, Paul



Subject: RE: java.lang.InstantiationException using Ibatis DAODate: Mon, 8 Sep 2008 08:56:37
+0200From: n.beekman@wis.nlTo: user-java@ibatis.apache.org

Your AliasesDaoImpl should have a public constructor that takes a DaoManager as its single
argument. Can you check that this is the case?
 
Hth,
 
Niels
 



Sell your car for just $40 at CarPoint.com.au It's simple! 
 



Find great deals on eBay Net yourself a bargain

Play now to win prizes for you and your friends! Are you a friend magnet? 
_________________________________________________________________
Are you a friend magnet? Play now to win prizes for you and your friends!
http://clk.atdmt.com/GBL/go/106906016/direct/01/?href=http://www.friendmagnet.com.au
Mime
View raw message