Hi,

okay, this really makes sense. Even the Spring documentation says:

"Not all JPA providers impose the need of a JVM agent (Hibernate being an 
example). If your provider does not require an agent or you have other 
alternatives (for example applying enhancements at build time through a custom 
compiler or an ant task) the load time weaver should not be used."

So the warnings because of the missing LoadTimeWeaver really are just warnings 
and do not restrict the application, provided that the entities are already 
enhanced.

But even without any LoadTimeWeaver, lazy fetching does not work. Are there any 
OpenJPA settings I might have forgotten, or again some bad Spring configuration?

So far, I have my entityManagerFactory configured this way:

<bean id="entityManagerFactory" 
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="GhostTO" />
        <property name="jpaVendorAdapter">
                <bean 
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
                        <property name="database" value="MYSQL"/>
                        <property name="showSql" value="true"/>
                </bean>
        </property>
        <property name="jpaDialect">
              <bean class="org.springframework.orm.jpa.vendor.OpenJpaDialect"/>
        </property>
</bean>

Greetings!
Naomi

-------- Original-Nachricht --------
> Datum: Wed, 20 May 2009 06:26:55 -0700 (PDT)
> Von: Rick Curtis <[email protected]>
> An: [email protected]
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> 
> Naomi-
> 
> I was thinking about this problem some more this morning and since you're
> enhancing your Entities at build time, there isn't any reason to have a
> Spring weaver configured. I did some digging around and found a forum post
> regarding this very issue [1]. 
> 
> -Rick
> 
> [1] http://forum.springsource.org/showthread.php?t=44299
> 
> 
> Naomi-san wrote:
> > 
> > Hi Rick,
> > 
> > thank you so much for your time you spent!
> > 
> > Aww, I knew, that there was a time I did not have that enhance-message,
> > but I thought I just imagined it ;)
> > I already used the InstrumentationLoadTimeWeaver some time before (that
> is
> > why it was commented out in db.xml), but got warning messages that I had
> > to use it with a Java agent. Because configuration examples for Spring
> and
> > OpenJPA which I found in the internet used SimpleLoadTimeWeaver, I also
> > did so.
> > 
> > Thanks to you I had a hint where the problem might be and could search
> > more specificly and found this discussion:
> > 
> > https://issues.apache.org/jira/browse/OPENJPA-40
> > 
> > It seems that the LoadTimeWeavers provided by Spring have problems with
> > the possible byte code enhancement at runtime (or something like that). 
> > There is also an alternative "OpenJpaLoadTimeWeaver" attached, which
> just
> > excludes the org.apache.openjpa package (don't know why this helps...).
> I
> > could not find it in the Spring package where it should reside, so I
> just
> > added the source to my project, and included it in my db.xml as
> > LoadTimeWeaver.
> > 
> > Now it works without the error message but still I have another problem.
> I
> > first thought it was because the classes are not enhanced / the error
> > message, but as we found out, this is not the case:
> > 
> > I can not use lazy fetching for relations where I set the
> FetchType.LAZY.
> > If I want to get the content of the specific attributes, I always get a
> > null value (and there definitely should be any content).
> > Lazy fetching for attributes that where mapped with FetchType.EAGER but
> > reached the MaxFetchDepth does not seem to be a problem.
> > 
> > Any ideas? ^^"
> > 
> > Greetings!
> > Naomi
> > 
> > -------- Original-Nachricht --------
> >> Datum: Tue, 19 May 2009 11:05:17 -0700 (PDT)
> >> Von: Rick Curtis <[email protected]>
> >> An: [email protected]
> >> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> > 
> >> 
> >> Naomi --
> >> 
> >> I've spent the better part of my morning trying to figure out what was
> >> going
> >> on and I finally have an answer for you. Please don't ask me to explain
> >> why
> >> I did what I did, because honestly I'm not entirely sure what the
> problem
> >> is. Through debugging I found that there was some class definition
> >> oddness
> >> when your JUnit started running through Spring code. Please let me know
> >> if
> >> you would like more details, otherwise see below for a
> 'fix'/workaround.
> >> 
> >> In your db.xml file you define a loadTimeWeaver property for bean
> >> id="entityManagerFactory". I noticed that you had two properties and
> one
> >> of
> >> them was commented out.  When I switched from
> >> org.springframework.instrument.classloading.SimpleLoadTimeWeaver to
> >>
> org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver,
> >> the JUnit passed. Please give that a shot. 
> >> 
> >> -Rick
> >> -- 
> >> View this message in context:
> >>
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2941253.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > 
> > -- 
> > Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> > Telefonanschluss für nur 17,95 Euro/mtl.!*
> >
> http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a
> > 
> > 
> 
> -- 
> View this message in context:
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2946115.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss 
für nur 17,95 Euro/mtl.!* 
http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a

Reply via email to