I am using Tomcat 5.0.28 web container and I am not sure if the
instances are serialized into the http session though my guess would be
that this does not happen. Also the instances contain version data.
Regardless I tried setting the openjpa.DetachState property.
<property name="openjpa.DetachState"
value="fetch-groups(DetachedStateField=true,DetachedStateManager=true,Ac
cessUnloaded=false)" />

But still get the same exception.
Do u think the open jpa bugs, 
https://issues.apache.org/jira/browse/OPENJPA-231
https://issues.apache.org/jira/browse/OPENJPA-255

might have something to do with the issue I am seeing?

Adish


-----Original Message-----
From: Patrick Linskey [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 23, 2007 7:02 AM
To: [email protected]
Subject: Re: Help Needed - Integrating OpenJPA in webapp using Struts

Hi,

What web container are you using? Could the instances be being
serialized into the session? If so, what happens if you set the
'openjpa.DetachState' property to 'DetachedStateField=true'?

This setting defaults to 'transient', which means that detached state
won't persist across serialization.

Alternately, I believe that if your instances contain optimistic lock
version data, this shouldn't be necessary.

-Patrick

[1]
http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_detac
h_graph

On 10/21/07, Adish Abnave <[EMAIL PROTECTED]> wrote:
> I have my DAO layer implemented using open JPA. My service
> implementation code is made Transactional using the
>
> Spring "@Transactional" annotation. I have my service test case
extended
> from the AbstractJpaTests and the test cases simulate detached objects
> by ending a transaction and starting a new one. When ever I end a
> transaction the Entity's stateManager instance is instance of
> DetachedStateManager indicating it is detached entity. I merge the
> detached entities and all test cases pass. When I integrate my service
> code with the Web App I put the detached Entities on the Http Session
> and merge them later but I get the EntityExistsException when merging
> detached Entites. Also the stateManager instance is null, I would have
> expected it to be DetachedStateManager.I am using the Spring
frameworks
> Transaction manager.
>
>
>
> Below is my JPA config,
>
>
>
>  <!-- JPA Configuration Beans Wiring -->
>
>     <bean id="entityManagerFactory"
>
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBea
> n">
>
>         <property name="dataSource" ref="dataSource"/>
>
>         <property name="jpaVendorAdapter">
>
>             <bean
> class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
>
>                 <property name="showSql" value="false"/>
>
>                 <property name="generateDdl" value="true"/>
>
>                 <property name="databasePlatform"
> value="org.apache.openjpa.jdbc.sql.OracleDictionary"/>
>
>             </bean>
>
>         </property>
>
>         <property name="jpaDialect">
>
>             <bean
> class="com.inxight.mdr.core.jpa.OracleOpenJpaDialect"/>
>
>         </property>
>
>         <property name="loadTimeWeaver">
>
>             <bean
>
class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"
> />
>
>         </property>
>
>     </bean>
>
>
>
>     <bean id="jpaTemplate"
> class="org.springframework.orm.jpa.JpaTemplate">
>
>         <property name="entityManagerFactory"
> ref="entityManagerFactory"/>
>
>     </bean>
>
>
>
>     <bean name="transactionManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
>
>         <property name="entityManagerFactory"
ref="entityManagerFactory"
> />
>
>         <property name="dataSource" ref="dataSource"/>
>
>     </bean>
>
>
>
>     <tx:annotation-driven proxy-target-class="true"/>
>
>
>
> If anyone is can shed some light on this issue it will be really
> helpful.
>
> Thanks,
>
> Adish
>
>
>
>
>
>


-- 
Patrick Linskey
202 669 5907

Reply via email to