[hibernate-dev] JPA: WAS 6.1 EntityManager performance and NPE in FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements

Jesper Udby jesper at udby.com
Thu Apr 19 03:08:40 EDT 2007


Hello,

just trying to follow the guidelines in the section "READ THIS BEFORE
USING JIRA!", I'm submitting minor changes to the classes
WebSphereExtendedJTATransactionLookup and FromClause for anyone to review...

1. We are using Hibernate JPA with WebSphere 6.1 and are experiencing
serious bad performance. We are also seeing alot of "INFO
org.hibernate.util.NamingHelper.JNDI InitialContext properties:{}" in the
logs (as described in http://forum.hibernate.org/viewtopic.php?t=970086).

Our investigations shows that the logging statements come from
NamingHelper.getInitialContext().

Also, we can se that just creating an EntityManager from an
EntitManagerFactory results in 4 times InitialContext creation and 4 times
lookup of the WAS specific "java:comp/websphere/ExtendedJTATransaction".

A simple transaction results in 7-8 lookups !

By looking at a similar implementation in OpenJPA's
(openjpa-0.9.6-incubating) AutomaticManagedRuntime / WASManagedRuntime, it
appears that OpenJPA only looks up the "extended transaction" object once,
and stores it in a static.

I've changed the WebSphereExtendedJTATransactionLookup so the innerclass
TransactionAdapter ctor does the lookup and stores the
extendedJTATransaction in a static in the
WebSphereExtendedJTATransactionLookup class.

This solves our performance problems.

Now, the WebSphereExtendedJTATransactionLookup class is not heavily
documented (...) so it is not obvious to us if this breaks something else.

2. NPE in
FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements

We have 2 Named queries (defined as annotions on the relavant entity) that
basically breaks the Hibernate JPA initialization, as a
NullPointerException is thrown in line 120 of
FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements().

I've taken the liberty to change the "direction" of the equals in the
if-statement, assuming that the "specifiedAlias" is never null.

This solves the NPE problem.

Please find attached the 2 modified files and don't flame me if I'm not
following procedures.

Kind regards

Jesper Udby
Freelance I/T Consultant

-------------- next part --------------
A non-text attachment was scrubbed...
Name: WebSphereExtendedJTATransactionLookup.java
Type: application/octet-stream
Size: 7005 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/hibernate-dev/attachments/20070419/ba215cb4/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FromClause.java
Type: application/octet-stream
Size: 12353 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/hibernate-dev/attachments/20070419/ba215cb4/attachment-0001.obj 


More information about the hibernate-dev mailing list