Foren

openSession() is null in LR7

mahesh gade, geändert vor 6 Jahren.

openSession() is null in LR7

Junior Member Beiträge: 44 Beitrittsdatum: 05.12.13 Neueste Beiträge
Hi friends,

I have implemented custom-sql queries in osgi module LR7.in *finderImpl class i am using openSession() but am getting NullpointerException in openSession().


Session session = null;
try{


session = openSession(); // here Null pointer exception


String sql = CustomSQLUtil.get(getClass(),FETCH_DATA_FOR_CAROSIL);
SQLQuery query = session.createSQLQuery(sql);
query.setCacheable(false);
query.addEntity("Test", TestImpl.class);
QueryPos pos = QueryPos.getInstance(query);
pos.add(storeId);
pos.add(deltaPeriod);
return (List<Order>)query.list();
}catch(Exception e){
throw new SystemException(e);
}
finally{
/
closeSession(session);
}


any one have idea about this?
thumbnail
Olaf Kock, geändert vor 6 Jahren.

RE: openSession() is null in LR7

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
How/from where are you using this? This information would be more important than the code that isn't reached anyways.

It might help to know what exactly fails - because the line you mark doesn't make any null-reference - this would be within openSession(). Lastly, please state your (exact) version.
mahesh gade, geändert vor 6 Jahren.

RE: openSession() is null in LR7

Junior Member Beiträge: 44 Beitrittsdatum: 05.12.13 Neueste Beiträge
Thanks Olaf for quick reply.

it was solved .i did wrong in code.