openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sreedhar.sirigiri" <>
Subject Equivalent class in OpenJPA.
Date Fri, 03 Aug 2007 13:21:45 GMT

Hi All,

We are porting our application from Hibernate to OpenJPA in the Database
tier. We faced performance problems while processing the JPQL queries.

here are the sample code snippets:


//do something

Criteria criteria = session.createCriteria(GeneralConfigDTO.class);
criteria.add(Expression.eq("name", configName));
GeneralConfigDTO configDTO = (GeneralConfigDTO)criteria.uniqueResult();

//do something

//do something

Query query = session.createQuery("select model from GeneralConfigDTO model
where = '"+configName+"'");
  GeneralConfigDTO configDTO = (GeneralConfigDTO)query.getSingleResult();
}catch(NoResultException nre){
  configDTO = null;
}catch(NonUniqueResultException ure){
  configDTO = null;

//do something

We have around 21 tuples in the relation "GeneralConfigDTO".

The Hibernate code snippet is getting executed in around 20msecs, whereas,
OpenJPA code snippet is taking around 400msecs, which is accounting for
overall performance of the Application.

The reason why we went for JPQL is because, we didn't find an equivalent
Hibernate's "Criteria" class in OpenJPA. 

Is there any configurations that we have to do to optimize JPQL queries.

Is there any equivalent class for "Criteria" in OpenJPA.

Any help would be highly appreciated.

Thanks in advance.

Sreedhar Sirigiri.

View this message in context:
Sent from the OpenJPA Developers mailing list archive at

View raw message