openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sreedhar.sirigiri" <sreedhar.sirig...@gmail.com>
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:

Hibernate:

//do something

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

//do something

OpenJPA:
//do something

Query query = session.createQuery("select model from GeneralConfigDTO model
where model.name = '"+configName+"'");
try{
  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: http://www.nabble.com/Equivalent-class-in-OpenJPA.-tf4212515.html#a11983221
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message