[hibernate-dev] JPA: WAS 6.1 EntityManager performance and NPE in FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements
Max Rydahl Andersen
max.andersen at redhat.com
Thu Apr 19 03:45:43 EDT 2007
> 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.
Stores in a static ? So what happens if you have more than one hibernate
app running ?
Doesn't sound right.
/max
> 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
>
--
--
Max Rydahl Andersen
callto://max.rydahl.andersen
Hibernate
max at hibernate.org
http://hibernate.org
JBoss a division of Red Hat
max.andersen at jboss.com
More information about the hibernate-dev
mailing list