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 Tue, 09 Sep 2008 08:19:57 GMT

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! 
_________________________________________________________________
Net yourself a bargain. Find great deals on eBay.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Frover%2Eebay%2Ecom%2Frover%2F1%2F705%2D10129%2D5668%2D323%2F4%3Fid%3D10&_t=763807330&_r=hotmailTAGLINES&_m=EXT
Mime
View raw message