Hibernate version: 3.2
Mapping documents:
addressdata.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.Addressdata" table="addressdata" catalog="pao">
<composite-id>
<key-property name="accountid" type="java.lang.Integer">
<column name="ACCOUNTID" />
</key-property>
<key-property name="contactid" type="java.lang.Integer">
<column name="CONTACTID" />
</key-property>
<key-property name="addrtypeid" type="java.lang.String">
<column name="ADDRTYPEID" length="3" />
</key-property>
<key-property name="sequence" type="java.lang.Short">
<column name="SEQUENCE" />
</key-property>
<key-property name="compid" type="java.lang.Integer">
<column name="COMPID" />
</key-property>
</composite-id>
<many-to-one name="generalid" class="com.DAO.account.General" column="generalid">
</many-to-one>
<property name="reltype" type="java.lang.String">
<column name="RELTYPE" length="1" />
</property>
</class>
</hibernate-mapping>
general.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.General" table="general" catalog="pao">
<id name="generalid" type="java.lang.Integer">
<column name="GENERALID" />
<generator class="native" />
</id>
<property name="admoid" type="java.lang.Integer">
<column name="ADMOID" not-null="true" />
</property>
<many-to-one name="countryid" column="COUNTRYID" class="com.DAO.account.Country">
</many-to-one>
<property name="district" type="java.lang.String">
<column name="DISTRICT" length="40" />
</property>
<property name="ilnnum" type="java.lang.String">
<column name="ILNNUM" length="20" />
</property>
<property name="information" type="java.lang.String">
<column name="INFORMATION" length="60" />
</property>
<property name="municipalid" type="java.lang.String">
<column name="MUNICIPALID" length="15" />
</property>
<property name="mutdat" type="java.util.Date">
<column name="MUTDAT" length="10" />
</property>
<property name="number" type="java.lang.Integer">
<column name="NUMBER" />
</property>
<property name="numberext" type="java.lang.String">
<column name="NUMBEREXT" length="15" />
</property>
<many-to-one name="placeid" column="PLACEID" class="com.DAO.account.Place">
</many-to-one>
<property name="postcode" type="java.lang.String">
<column name="POSTCODE" length="10" />
</property>
<property name="stateid" type="java.lang.String">
<column name="STATEID" length="2" />
</property>
<property name="street" type="java.lang.String">
<column name="STREET" length="100" />
</property>
<property name="street1" type="java.lang.String">
<column name="STREET1" length="100" />
</property>
<property name="street2" type="java.lang.String">
<column name="STREET2" length="100" />
</property>
</class>
</hibernate-mapping>
place.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.Place" table="place" catalog="pao">
<id name="placeid" type="java.lang.String">
<column name="PLACEID" length="15" />
<generator class="native" />
</id>
<property name="municipalid" type="java.lang.String">
<column name="MUNICIPALID" length="15" />
</property>
<property name="placedesc" type="java.lang.String">
<column name="PLACEDESC" length="30" />
</property>
<property name="platelnet" type="java.lang.String">
<column name="PLATELNET" length="8" />
</property>
<property name="stateid" type="java.lang.String">
<column name="STATEID" length="2" not-null="true" />
</property>
</class>
</hibernate-mapping>
state.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.State" table="state" catalog="pao">
<id name="stateid" type="java.lang.String">
<column name="STATEID" length="2" />
<generator class="native" />
</id>
<property name="countryid" type="java.lang.String">
<column name="COUNTRYID" length="3" not-null="true" />
</property>
<property name="statedesc" type="java.lang.String">
<column name="STATEDESC" length="30" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public static List find(String query ,HttpServletRequest request,String className)
{
Session session;
List result;
ServletContext context=request.getSession().getServletContext();
SessionFactory _factory = (SessionFactory) context.getAttribute("SESSION_FACTORY_KEY_CRM");
session=_factory.openSession();
result = (session.createSQLQuery(query).addEntity(className)).list();
return result;
}
Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not load an entity: [com.DAO.account.General#3]
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:820)
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:62)
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158)
com.DAO.account.General$$EnhancerByCGLIB$$f7ee11a2.getPlaceid()
com.BO.account.AccountActionBo.findPlace(AccountActionBo.java:83)
com.BO.account.AccountActionBo.searchGroup(AccountActionBo.java:63)
com.action.account.AccountAction.searchGroup(AccountAction.java:109)
com.action.account.AccountAction.handleAction(AccountAction.java:52)
com.common.ChallengeAction.execute(ChallengeAction.java:39)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
Name and version of the database you are using: mysql 5.0
java code
List lList= lAddressdata.findPlaceFromGeneral(pAccountEditBean.getAccountid(),pReq);
System.out.print("\n\n\nfindplace21\n\n\n"+lList.size()+"\n\n"+pAccountEditBean.getAccountid());
if(lList.size()>0){
for(Object obj:lList){
lAddressdata=(Addressdata)obj;
System.out.print("\n\n\nfindplace3\n\n\n");
pAccountEditBean.setPlacedesc(((Place)((General)lAddressdata.getGeneralid()).getPlaceid()).getPlacedesc());
System.out.print("\n\n\nfindplace4");
}}
*****************************************************
public List findPlaceFromGeneral(Integer laccountid, HttpServletRequest req) {
StringBuffer lStringBuffer=new StringBuffer(Query);
lStringBuffer.append(" where accountid ='"+laccountid+"'");
lStringBuffer.append(" and addrtypeid='ADR'");
return ChallengeDao.find(lStringBuffer.toString(), req, className);
// TODO Auto-generated method stub
}
****************************************************
My problem is the query have been executed properly and i got the results. but while trying to get the generalid value its showing me this type of exception.
The program is executed upto findplace 3 . after that its showing me the above exception
|