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_detach_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
