HI

I've pasted in the method findCompanyByCvrNo below. The method uses a query to 
fetch the company by cvrNo. The query is also pastes below.

Yes I'm completly sure that my session beans are using the Stateless 
annotation. I don't know if this is a stateless session bena problem or a 
hibernate/EM problem. I'm just using EJB3 and doesn't care about the JBOSS EJB3 
implementation. 

Yes the two scenarios are different. Scenario A is fetching branches through 
the oneToMany relationship between company and branches. Scenario B is fetching 
branches using a query. Scenario B has far better performance than A - that is 
a problem, because I'll have to change all our OneToMany fetches to queries 
(specially when we fetch more than 100 rows).


I've tried out the scenarios on Oracles OC4J and here is the performance not a 
problem, so I think it's a problem in Hibernate or the EJB container.


  |   public CompanyPO FindCompanyByCvrNo(String cvrNo) throws DaoException {
  |     CompanyPO c = null;
  | 
  |     try {
  |       c = 
(CompanyPO)em.createNamedQuery("findCompanyByCvrNo").setParameter("cvrNo", 
cvrNo).getSingleResult();
  |     }
  |     catch (EntityNotFoundException notFound) {
  |       // create new company by calling CVR
  |       c = CvrDAO.getCVRInfo(cvrNo);
  |     }
  |     catch (Exception e) {
  |       throw new DaoException(e);
  |     }
  | 
  |     return c;
  |   }
  | 

EJB Query

  | @NamedQuery(name = "findCompanyByCvrNo", 
  |             queryString = "SELECT c FROM CompanyPO c WHERE c.cvrNo = 
:cvrNo")
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3937848#3937848

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3937848


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to