Hi! I use Hibernate 3.3.1 with JPA/EJB3/Glassfish/JBoss Cache. There was an idea than making read only method of stateless session bean (for example findById(...)) annotated by @NotSupported or @Supports will make it faster than with default transaction attribute @Requires. Surprisingly, annotating method with @NotSupported made its execution much slower (1500 msec vs 120 ms)! I tried to disable second level cache (JBoss cache), it doesn't help. Profiling my application I found that method findById() have several hundreds of calls to JoinableCMTTransaction.isTransactionInProgress() method that slows up the execution of method. Also I add <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/> to my persistence.xml, it doesn't help too.
Code: @Stateless public class CompanyServiceBean implements CompanyService { ... @PersistenceContext private EntityManager em; ... @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public Company findWithNotSupported(Long id) { Company res = em.find(Company.class, id); // executes 1500 ms return res; } ... @TransactionAttribute(TransactionAttributeType.REQUIRES) public Company findWithRequires(Long id) { Company res = em.find(Company.class, id); // executes 120 ms return res; } ...
What can be wrong in my application?
|