Hi Kris,
I am attaching more of the exception i missed out last time.
Thanks
Prashanth.
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
com/wirelessmob/solutions/dataaccess/persistence/sqlmapdao/sql/Shop.xml.
--- The error occurred while applying a result map.
--- Check the Shop.shopResult.
--- The error happened while setting a property on the result object.
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error setting
properties of
'[EMAIL PROTECTED]'. Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error setting
properties of
'[EMAIL PROTECTED]'. Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:183)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:99)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:348)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:333)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:82)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:57)
at
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject(SqlMapDaoTemplate.java:162)
... 24 more
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error setting
properties of
'[EMAIL PROTECTED]'. Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at
com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:51)
at
com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java:109)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:168)
at
com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:47)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:302)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:146)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:200)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:168)
... 30 more
Caused by: java.lang.NullPointerException
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:324)
at
com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:45)
--- Prashanth Sukumaran <[EMAIL PROTECTED]> wrote:
> Hi Kris,
>
> Thanks for replying.
>
> It is just a simple POJO. I created it using eclipse "Generate getters and
> setters".
> I am pasting the bean here. I have p6spy enabled, I see that the SQL Query is
> returning exactly
> one row. The <result-map> is a one to one mapping of the column name to the
> bean fields.
>
> I am not defining what the "null" column value should be treated as. But
> that is not required
> right. Also i feel the problem is with the "int" being mapped to "NULL".
>
> Hasn't anybody had this error????? :-(
>
> Thanks
> Prashanth.
>
> /*
> * Created on Oct 7, 2004
> *
> * TODO To change the template for this generated file go to
> * Window - Preferences - Java - Code Style - Code Templates
> */
> package com.wirelessmob.solutions.dataaccess.beans;
>
> import java.util.List;
>
> /**
> * @author Prashanth Sukumaran
> *
> * TODO To change the template for this generated type comment go to
> * Window - Preferences - Java - Code Style - Code Templates
> */
> public class Shop {
>
>
> private int shopId;
> private String shopName;
> private String shopStreetAddress1;
> private String shopStreetAddress2;
> private String shopCity;
> private String stateId;
> private String shopZipCode;
> private String shopPhone;
> private String shopContact;
> private String shopContactEmail;
>
> private int multiShopLocationId;
> private int multiShopHeadquarters;
> private int shopTypeId;
> private int dealerType;
> private int dealerGroupId;
> private int affiliationId;
> private int groups20Id;
> private String primaryDistName;
> private String primaryDistCity;
> private String primaryDistPhone;
> private String primaryDistStateCd;
>
> private String[] franchiseLinesIds;
> private String[] paintBrandsIds;
> private String franchiseLinesNames;
> private String paintBrandNames;
> private List sponsorDealers;
> private String sdIds;
> private String salesRep;
>
> private int shopHeadquarters;
> private String otherMultiShopLocation;
> private String otherFranchiseLines;
> private String otherDealerGroup;
> private String otherPaintBrands;
> private String other20GroupsId;
> private String otherAffiliation;
> private String createdBy;
> private java.sql.Date createdDate;
> private String modifiedBy;
> private java.sql.Date modifiedDate;
>
> public Shop() {
> createdDate = new java.sql.Date(System.currentTimeMillis());
> modifiedDate = new java.sql.Date(System.currentTimeMillis());
> }
>
> /**
> * @return Returns the createdBy.
> */
> public String getCreatedBy() {
> return createdBy;
> }
> /**
> * @param createdBy The createdBy to set.
> */
> public void setCreatedBy(String createdBy) {
> this.createdBy = createdBy;
> }
> /**
> * @return Returns the createdDate.
> */
> public java.sql.Date getCreatedDate() {
> return createdDate;
> }
> /**
> * @param createdDate The createdDate to set.
> */
> public void setCreatedDate(java.sql.Date createdDate) {
> this.createdDate = createdDate;
> }
> /**
> * @return Returns the modifiedBy.
> */
> public String getModifiedBy() {
> return modifiedBy;
> }
> /**
> * @param modifiedBy The modifiedBy to set.
> */
> public void setModifiedBy(String modifiedBy) {
> this.modifiedBy = modifiedBy;
> }
> /**
> * @return Returns the modifiedDate.
> */
> public java.sql.Date getModifiedDate() {
> return modifiedDate;
> }
> /**
> * @param modifiedDate The modifiedDate to set.
> */
> public void setModifiedDate(java.sql.Date modifiedDate) {
> this.modifiedDate = modifiedDate;
> }
> /**
> * @return Returns the paintBrandNames.
> */
> public String getPaintBrandNames() {
> return paintBrandNames;
> }
> /**
> * @param paintBrandNames The paintBrandNames to set.
> */
> public void setPaintBrandNames(String paintBrandNames) {
> this.paintBrandNames = paintBrandNames;
> }
> /**
> * @return Returns the franchiseLinesNames.
> */
> public String getFranchiseLinesNames() {
> return franchiseLinesNames;
> }
> /**
> * @param franchiseLinesNames The franchiseLinesNames to set.
> */
> public void setFranchiseLinesNames(String franchiseLinesNames) {
> this.franchiseLinesNames = franchiseLinesNames;
> }
> /**
> * @return Returns the sdIds.
> */
> public String getSdIds() {
> return sdIds;
> }
> /**
> * @param sdIds The sdIds to set.
> */
> public void setSdIds(String sdIds) {
> this.sdIds = sdIds;
> }
> /**
> * @return Returns the sponsorDealers.
> */
> public List getSponsorDealers() {
> return sponsorDealers;
> }
> /**
> * @param sponsorDealers The sponsorDealers to set.
> */
> public void setSponsorDealers(List sponsorDealers) {
> this.sponsorDealers = sponsorDealers;
> }
>
> /**
> * @return Returns the shopId.
> */
> public int getShopId() {
> return shopId;
> }
> /**
> * @param shopId The shopId to set.
> */
> public void setShopId(int shopId) {
> this.shopId = shopId;
> }
> /**
> * @return Returns the shopName.
> */
> public String getShopName() {
> return shopName;
> }
> /**
> * @param shopName The shopName to set.
> */
> public void setShopName(String shopName) {
> this.shopName = shopName;
> }
>
> /**
> * @return Returns the affiliationId.
> */
> public int getAffiliationId() {
> return affiliationId;
> }
> /**
> * @param affiliationId The affiliationId to set.
> */
> public void setAffiliationId(int affiliationId) {
> this.affiliationId = affiliationId;
> }
> /**
> * @return Returns the dealerGroupId.
> */
> public int getDealerGroupId() {
> return dealerGroupId;
> }
> /**
> * @param dealerGroupId The dealerGroupId to set.
> */
> public void setDealerGroupId(int dealerGroupId) {
> this.dealerGroupId = dealerGroupId;
> }
> /**
> * @return Returns the dealerType.
> */
> public int getDealerType() {
> return dealerType;
> }
> /**
> * @param dealerType The dealerType to set.
> */
> public void setDealerType(int dealerType) {
> this.dealerType = dealerType;
> }
>
> /**
> * @return Returns the franchiseLinesIds.
> */
> public String[] getFranchiseLinesIds() {
> return franchiseLinesIds;
> }
> /**
> * @param franchiseLinesIds The franchiseLinesIds to set.
> */
> public void setFranchiseLinesIds(String[] franchiseLinesIds) {
> this.franchiseLinesIds = franchiseLinesIds;
> }
> /**
> * @return Returns the groups20Id.
> */
> public int getGroups20Id() {
> return groups20Id;
> }
> /**
> * @param groups20Id The groups20Id to set.
> */
> public void setGroups20Id(int groups20Id) {
> this.groups20Id = groups20Id;
> }
> /**
> * @return Returns the multiShopHeadquarters.
> */
> public int getMultiShopHeadquarters() {
> return multiShopHeadquarters;
> }
> /**
> * @param multiShopHeadquarters The multiShopHeadquarters to set.
> */
> public void setMultiShopHeadquarters(int multiShopHeadquarters) {
> this.multiShopHeadquarters = multiShopHeadquarters;
> }
> /**
> * @return Returns the multiShopLocationId.
> */
> public int getMultiShopLocationId() {
> return multiShopLocationId;
> }
> /**
> * @param multiShopLocationId The multiShopLocationId to set.
> */
> public void setMultiShopLocationId(int multiShopLocationId) {
> this.multiShopLocationId = multiShopLocationId;
> }
> /**
> * @return Returns the paintBrandsIds.
> */
> public String[] getPaintBrandsIds() {
> return paintBrandsIds;
> }
> /**
> * @param paintBrandsIds The paintBrandsIds to set.
> */
> public void setPaintBrandsIds(String[] paintBrandsIds) {
> this.paintBrandsIds = paintBrandsIds;
> }
> /**
> * @return Returns the primaryDistCity.
> */
> public String getPrimaryDistCity() {
> return primaryDistCity;
> }
> /**
> * @param primaryDistCity The primaryDistCity to set.
> */
> public void setPrimaryDistCity(String primaryDistCity) {
> this.primaryDistCity = primaryDistCity;
> }
> /**
> * @return Returns the primaryDistName.
> */
> public String getPrimaryDistName() {
> return primaryDistName;
> }
> /**
> * @param primaryDistName The primaryDistName to set.
> */
> public void setPrimaryDistName(String primaryDistName) {
> this.primaryDistName = primaryDistName;
> }
> /**
> * @return Returns the primaryDistPhone.
> */
> public String getPrimaryDistPhone() {
> return primaryDistPhone;
> }
> /**
> * @param primaryDistPhone The primaryDistPhone to set.
> */
> public void setPrimaryDistPhone(String primaryDistPhone) {
> this.primaryDistPhone = primaryDistPhone;
> }
> /**
> * @return Returns the primaryDistStateCd.
> */
> public String getPrimaryDistStateCd() {
> return primaryDistStateCd;
> }
> /**
> * @param primaryDistStateCd The primaryDistStateCd to set.
> */
> public void setPrimaryDistStateCd(String primaryDistStateCd) {
> this.primaryDistStateCd = primaryDistStateCd;
> }
> /**
> * @return Returns the shopCity.
> */
> public String getShopCity() {
> return shopCity;
> }
> /**
> * @param shopCity The shopCity to set.
> */
> public void setShopCity(String shopCity) {
> this.shopCity = shopCity;
> }
> /**
> * @return Returns the shopContact.
> */
> public String getShopContact() {
> return shopContact;
> }
> /**
> * @param shopContact The shopContact to set.
> */
> public void setShopContact(String shopContact) {
> this.shopContact = shopContact;
> }
> /**
> * @return Returns the shopContactEmail.
> */
> public String getShopContactEmail() {
> return shopContactEmail;
> }
> /**
> * @param shopContactEmail The shopContactEmail to set.
> */
> public void setShopContactEmail(String shopContactEmail) {
> this.shopContactEmail = shopContactEmail;
> }
>
> /**
> * @return Returns the shopPhone.
> */
> public String getShopPhone() {
> return shopPhone;
> }
> /**
> * @param shopPhone The shopPhone to set.
> */
> public void setShopPhone(String shopPhone) {
> this.shopPhone = shopPhone;
> }
> /**
> * @return Returns the shopStateCd.
> */
> public String getStateId() {
> return stateId;
> }
> /**
> * @param shopStateCd The shopStateCd to set.
> */
> public void setStateId(String stateId) {
> this.stateId = stateId;
> }
> /**
> * @return Returns the shopStreetAddress1.
> */
> public String getShopStreetAddress1() {
> return shopStreetAddress1;
> }
> /**
> * @param shopStreetAddress1 The shopStreetAddress1 to set.
> */
> public void setShopStreetAddress1(String shopStreetAddress1) {
> this.shopStreetAddress1 = shopStreetAddress1;
> }
> /**
> * @return Returns the shopStreetAddress2.
> */
> public String getShopStreetAddress2() {
> return shopStreetAddress2;
> }
> /**
> * @param shopStreetAddress2 The shopStreetAddress2 to set.
> */
> public void setShopStreetAddress2(String shopStreetAddress2) {
> this.shopStreetAddress2 = shopStreetAddress2;
> }
> /**
> * @return Returns the shopTypeId.
> */
> public int getShopTypeId() {
> return shopTypeId;
> }
> /**
> * @param shopTypeId The shopTypeId to set.
> */
> public void setShopTypeId(int shopTypeId) {
> this.shopTypeId = shopTypeId;
> }
> /**
> * @return Returns the shopZipCode.
> */
> public String getShopZipCode() {
> return shopZipCode;
> }
> /**
> * @param shopZipCode The shopZipCode to set.
> */
> public void setShopZipCode(String shopZipCode) {
> this.shopZipCode = shopZipCode;
> }
> /**
> * @return Returns the other20GroupsId.
> */
> public String getOther20GroupsId() {
> return other20GroupsId;
> }
> /**
> * @param other20GroupsId The other20GroupsId to set.
> */
> public void setOther20GroupsId(String other20GroupsId) {
> this.other20GroupsId = other20GroupsId;
> }
> /**
> * @return Returns the otherAffiliation.
> */
> public String getOtherAffiliation() {
> return otherAffiliation;
> }
> /**
> * @param otherAffiliation The otherAffiliation to set.
> */
> public void setOtherAffiliation(String otherAffiliation) {
> this.otherAffiliation = otherAffiliation;
> }
> /**
> * @return Returns the otherDealerGroup.
> */
> public String getOtherDealerGroup() {
> return otherDealerGroup;
> }
> /**
> * @param otherDealerGroup The otherDealerGroup to set.
> */
> public void setOtherDealerGroup(String otherDealerGroup) {
> this.otherDealerGroup = otherDealerGroup;
> }
> /**
> * @return Returns the otherFranchiseLines.
> */
> public String getOtherFranchiseLines() {
> return otherFranchiseLines;
> }
> /**
> * @param otherFranchiseLines The otherFranchiseLines to set.
> */
> public void setOtherFranchiseLines(String otherFranchiseLines) {
> this.otherFranchiseLines = otherFranchiseLines;
> }
> /**
> * @return Returns the otherMultiShopLocation.
> */
> public String getOtherMultiShopLocation() {
> return otherMultiShopLocation;
> }
> /**
> * @param otherMultiShopLocation The otherMultiShopLocation to set.
> */
> public void setOtherMultiShopLocation(String otherMultiShopLocation) {
> this.otherMultiShopLocation = otherMultiShopLocation;
> }
> /**
> * @return Returns the otherPaintBrands.
> */
> public String getOtherPaintBrands() {
> return otherPaintBrands;
> }
> /**
> * @param otherPaintBrands The otherPaintBrands to set.
> */
> public void setOtherPaintBrands(String otherPaintBrands) {
> this.otherPaintBrands = otherPaintBrands;
> }
> /**
> * @return Returns the shopHeadquarters.
> */
> public int getShopHeadquarters() {
> return shopHeadquarters;
> }
> /**
> * @param shopHeadquarters The shopHeadquarters to set.
> */
> public void setShopHeadquarters(int shopHeadquarters) {
> this.shopHeadquarters = shopHeadquarters;
> }
>
> /**
> * @return Returns the salesRep.
> */
> public String getSalesRep() {
> return salesRep;
> }
> /**
> * @param salesRep The salesRep to set.
> */
> public void setSalesRep(String salesRep) {
> this.salesRep = salesRep;
> }
> }
>
>
> --- Kris Jenkins <[EMAIL PROTECTED]> wrote:
>
> > Hey Prashanth,
> >
> > Can we see the code for Shop.java?
> >
> > Kris
> >
> > Prashanth Sukumaran wrote:
> >
> > >Hi,
> > >
> > >I am getting the following NestedSQLException. I think the problem is due
> > >to some null
> values
> > >stored in the database. Why should there be a Null Pointer Exception
> > >while setting the data
> > into
> > >the bean that i have passed?
> > >
> > >Has anybody got a similar error. I am also pasting the sql definition
> > >here.
> > >
> > >Thanks a lot
> > >
> > >Prashanth
> > >
> > >PS: IBatis is awsome. I love everything about the way it is done and way
> > >it helps me to
> write
> > >clean code. The XML representatioin of the SQL is the best. I don't like
> > >to have SQL in my
> > Java
> > >Code. Even though you will be adding new enhancements to iBatis, please
> > >keep this XML
> > >represenatation of SQL query as it is. Thanks a lot for all the hardwork
> > >you guys are putting
> > and
> > >make our lives easier.
> > >
> > >
> > ><select id="getShopByShopId" resultMap="shopResult" parameterClass="int">
> > >select
> > > SHOPID, SHOPNAME, SHOPSTREETADDRESS1, SHOPSTREETADDRESS2, SHOPCITY,
> > > STATEID, SHOPZIPCODE, REGIONID,
> > > DECODE(TBLSHOPS.TECHNICIAN,NULL,'', SALESMAN.SALESMAN_LAST_NM || ', ' ||
> > >SALESMAN.SALESMAN_FIRST_NM) SALESMAN_NAME
> > >from TBLSHOPS, SALESMAN
> > >WHERE TBLSHOPS.SHOPID = #value# AND
> > > TBLSHOPS.active = 'Y' AND
> > > TBLSHOPS.TECHNICIAN = SALESMAN.SALESMAN_ID (+)
> > >
> > ></select>
> > >
> > >
> > >Nested Exception is...
> > >com.ibatis.dao.client.DaoException: Failed to execute queryForObject - id
> > >[getShopByShopId],
> > >parameterObject [1877]. Cause:
> > >com.ibatis.common.jdbc.exception.NestedSQLException:
> > >--- The error occurred in
> > com/wirelessmob/solutions/dataaccess/persistence/sqlmapdao/sql/Shop.xml.
> > >
> > >--- The error occurred while applying a result map.
> > >--- Check the Shop.shopResult.
> > >--- The error happened while setting a property on the result object.
> > >--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error
> > >setting properties of
> > >'[EMAIL PROTECTED]'. Cause:
> > java.lang.NullPointerException
> > >Caused by: java.lang.NullPointerException
> > >Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
> > >setting properties of
> > >'[EMAIL PROTECTED]'. Cause:
> > java.lang.NullPointerException
> > >Caused by: java.lang.NullPointerException
> > >Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
> > >--- The error occurred in
> > com/wirelessmob/solutions/dataaccess/persistence/sqlmapdao/sql/Shop.xml.
> > >
> > >--- The error occurred while applying a result map.
> > >--- Check the Shop.shopResult.
> > >--- The error happened while setting a property on the result object.
> > >--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error
> > >setting properties of
> > >'[EMAIL PROTECTED]'. Cause:
> > java.lang.NullPointerException
> > >Caused by: java.lang.NullPointerException
> > >Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
> > >setting properties of
> > >'[EMAIL PROTECTED]'. Cause:
> > java.lang.NullPointerException
> > >Caused by: java.lang.NullPointerException
> > > at
> com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject(SqlMapDaoTemplate.java:164)
> > >
> > >
> > >
> > >__________________________________
> > >Do you Yahoo!?
> > >Read only the mail you want - Yahoo! Mail SpamGuard.
> > >http://promotions.yahoo.com/new_mail
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Kris Jenkins
> > Email: [EMAIL PROTECTED]
> > Blog: http://cafe.jenkster.com/
> > Wiki: http://wiki.jenkster.com/
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.300 / Virus Database: 265.6.11 - Release Date: 12/01/2005
> >
> >
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250