Forums de discussion

openSession() is null in LR7

mahesh gade, modifié il y a 6 années.

openSession() is null in LR7

Junior Member Publications: 44 Date d'inscription: 05/12/13 Publications récentes
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, modifié il y a 6 années.

RE: openSession() is null in LR7

Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentes
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, modifié il y a 6 années.

RE: openSession() is null in LR7

Junior Member Publications: 44 Date d'inscription: 05/12/13 Publications récentes
Thanks Olaf for quick reply.

it was solved .i did wrong in code.