hi there

i am attempting a very simple task of running a junit + spring
+...@persistencecontext but getting the following error

Caused by: java.lang.IllegalStateException: Application code attempted
to create a EntityManagerFactory named transactions-optional, but one
with this name already exists!  Instances of EntityManagerFactory are
extremely slow to create and it is usually not necessary to create one
with a given name more than once.  Instead, create a singleton and
share it throughout your code.  If you really do need to create a
duplicate EntityManagerFactory (such as for a unittest suite), set the
appengine.orm.disable.duplicate.emf.exception system property to avoid
this error.
        at
org.datanucleus.store.appengine.jpa.DatastoreEntityManagerFactory.checkForRepeatedAllocation
(DatastoreEntityM


the junit class is simple

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:entitymanager-
context.xml" })

public class PositionUserBusinessTest extends LocalStorageTestCase {

        @PersistenceContext
        EntityManager em;

        @Autowired
        PositionUserBusiness business;

 @test
 void something test()


entitymanager-context.xml

<!-- entity manager -->
        <bean id="entityManagerFactory"
                
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"
        lazy-init="true">
                <property name="persistenceUnitName" 
value="transactions-optional" /
>
        </bean>

        <bean name="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
                <property name="entityManagerFactory" 
ref="entityManagerFactory" />
        </bean>

        <bean id="positionUserBusiness"
 
class="com.asteriski.mingle.geo.business.PositionUserBusiness"/>




i dont understand why it is complaining about the mulitple instances
of persistence unit called ' transactions-optional' as it is only
being referenced by the spring binding.

what is the problem?

any help most appreciated.

-lp
-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to