persistence - Is there a way to change the JPA fetch type on a method? -


Is there a way to bring JPA on a method without editing the unit object?

I have a shared ORM layer that includes JPA unit class. This ORM layer is used by two DAO layers. A DAO needs a sluggish embrace, because it is for my web application, to bring curiosity to other needs, as I need it to be threshed.

Here is an example method from my Threseceph DAO,

 @Paristance CONTACT (unit name = "persistence unit", type = persistence contact text. Public Errorsearch SearchAircodebid (short ID) {return (error code) em.createNamedQuery ("ErrorCode.findById"). SetParameter ("id", id) .getSingleResult (); }  

How do I use this method (or whole class) to take curiosity?

 query q = HibernateUtil.getSessionFactory (). GetCurrentSession () .createQuery ("C Select C from the range in "; left include c categorized as ci" + "i as ci. 

B. One unit used to use hibernate inlet (entity) For the lazy relationships to load the curiosity (like through the finder ...)

 ErrorCode lazyCode = findErrorCodeById (1); // Curious Load Associations Hibernate.in initialize (Alsiodode); 

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -