prsubject
asked on
Nullpointer exception Hibernate
When I run a hibernate code I am getting the following exception. Need help please.
java.lang.NullPointerExcep tion
at org.hibernate.tuple.Abstra ctEntityTu plizer.cre ateProxy(A bstractEnt ityTuplize r.java:372 )
at org.hibernate.persister.en tity.Abstr actEntityP ersister.c reateProxy (AbstractE ntityPersi ster.java: 3121)
at org.hibernate.event.def.De faultLoadE ventListen er.createP roxyIfNece ssary(Defa ultLoadEve ntListener .java:232)
at org.hibernate.event.def.De faultLoadE ventListen er.proxyOr Load(Defau ltLoadEven tListener. java:173)
at org.hibernate.event.def.De faultLoadE ventListen er.onLoad( DefaultLoa dEventList ener.java: 87)
at org.hibernate.impl.Session Impl.fireL oad(Sessio nImpl.java :869)
at org.hibernate.impl.Session Impl.inter nalLoad(Se ssionImpl. java:838)
at org.hibernate.type.EntityT ype.resolv eIdentifie r(EntityTy pe.java:26 6)
at org.hibernate.type.EntityT ype.resolv e(EntityTy pe.java:30 3)
at org.hibernate.engine.TwoPh aseLoad.in itializeEn tity(TwoPh aseLoad.ja va:113)
at org.hibernate.loader.Loade r.initiali zeEntities AndCollect ions(Loade r.java:842 )
at org.hibernate.loader.Loade r.doQuery( Loader.jav a:717)
at org.hibernate.loader.Loade r.doQueryA ndInitiali zeNonLazyC ollections (Loader.ja va:224)
at org.hibernate.loader.Loade r.doList(L oader.java :2150)
at org.hibernate.loader.Loade r.listIgno reQueryCac he(Loader. java:2029)
at org.hibernate.loader.Loade r.list(Loa der.java:2 024)
at org.hibernate.loader.hql.Q ueryLoader .list(Quer yLoader.ja va:369)
at org.hibernate.hql.ast.Quer yTranslato rImpl.list (QueryTran slatorImpl .java:300)
at org.hibernate.engine.query .HQLQueryP lan.perfor mList(HQLQ ueryPlan.j ava:146)
at org.hibernate.impl.Session Impl.list( SessionImp l.java:109 3)
at org.hibernate.impl.QueryIm pl.list(Qu eryImpl.ja va:79)
at com.twc.soatest.dao.Digita lPhoneDAO. validateDP Activation (DigitalPh oneDAO.jav a:296)
at com.twc.soatest.db.SOATest DBUtil.val idateDPAct ivation(SO ATestDBUti l.java:275 )
at com.twc.soatest.db.TestSOA Test.main( TestSOATes t.java:27)
java.lang.NullPointerExcep
at org.hibernate.tuple.Abstra
at org.hibernate.persister.en
at org.hibernate.event.def.De
at org.hibernate.event.def.De
at org.hibernate.event.def.De
at org.hibernate.impl.Session
at org.hibernate.impl.Session
at org.hibernate.type.EntityT
at org.hibernate.type.EntityT
at org.hibernate.engine.TwoPh
at org.hibernate.loader.Loade
at org.hibernate.loader.Loade
at org.hibernate.loader.Loade
at org.hibernate.loader.Loade
at org.hibernate.loader.Loade
at org.hibernate.loader.Loade
at org.hibernate.loader.hql.Q
at org.hibernate.hql.ast.Quer
at org.hibernate.engine.query
at org.hibernate.impl.Session
at org.hibernate.impl.QueryIm
at com.twc.soatest.dao.Digita
at com.twc.soatest.db.SOATest
at com.twc.soatest.db.TestSOA
can you post the following code also.
validateDPActivation method in DigitalPhoneDAO class
validateDPActivation method in DigitalPhoneDAO class
ASKER
public boolean validateDPActivation(Strin g tn, Session session)
{
Application.showMessage("E ntering validateDPActivation - DigitalPhoneDAO");
Application.showMessage("T N retrieved from DB is "+tn);
boolean dpActivated=false;
List<ServiceProfile> spList = new ArrayList<ServiceProfile>( );
ServiceProfile sProfile = null;
try {
Query query = session.getNamedQuery("com .xxx.soate st.bsif.en tity.Servi ceProfile. getService ProfileByT N");
query.setString("tn", tn);
spList=query.list();
Application.showMessage("F rom DAO List size is "+spList.size());
for(int index=0; index<spList.size();index+ +)
{
sProfile= (ServiceProfile) spList.get(index);
}
/*if(spList.size() > 0)
dpActivated=true;*/
if(sProfile!= null && sProfile.getServiceUid().e quals(tn))
dpActivated=true;
}
catch(Exception e) {
e.printStackTrace();
}
finally {
session.close();
}
Application.showMessage("F rom DAO List size is "+spList.size());
System.out.println("From DAO List size is "+spList.size());
Application.showMessage("I nside DAO class is DPActivated "+dpActivated);
return dpActivated;
}
{
Application.showMessage("E
Application.showMessage("T
boolean dpActivated=false;
List<ServiceProfile> spList = new ArrayList<ServiceProfile>(
ServiceProfile sProfile = null;
try {
Query query = session.getNamedQuery("com
query.setString("tn", tn);
spList=query.list();
Application.showMessage("F
for(int index=0; index<spList.size();index+
{
sProfile= (ServiceProfile) spList.get(index);
}
/*if(spList.size() > 0)
dpActivated=true;*/
if(sProfile!= null && sProfile.getServiceUid().e
dpActivated=true;
}
catch(Exception e) {
e.printStackTrace();
}
finally {
session.close();
}
Application.showMessage("F
System.out.println("From DAO List size is "+spList.size());
Application.showMessage("I
return dpActivated;
}
ASKER
I am getting list size as 0 even if data exists
From DAO List size is 0
TN Exists false
This is my query in hbm.xml file
<query name="getServiceProfileByT N">
<![CDATA[FROM ServiceProfile a WHERE a.serviceUid= :tn]]>
</query>
From DAO List size is 0
TN Exists false
This is my query in hbm.xml file
<query name="getServiceProfileByT
<![CDATA[FROM ServiceProfile a WHERE a.serviceUid= :tn]]>
</query>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
select * from xxx sp
where sp.yyy='5124349071' is giving a record
where sp.yyy='5124349071' is giving a record
ASKER
I downloaded the hqe The bat file is not opening up. It is displaying some error and closing
ASKER
I need to show the results today. need help please.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@prsubject: if you need help in getting this cross-checked, please post the code here, i can help in that. Or let me know if any reference is required.
Also please check, if the value you are testing with is the same value which is getting passed to the query also and to the correct column.
Also please check, if the value you are testing with is the same value which is getting passed to the query also and to the correct column.
ASKER