[
http://jira.jboss.com/jira/browse/JBSEAM-1946?page=all ]
Jay Balunas resolved JBSEAM-1946.
---------------------------------
Resolution: Done
From what I can see the <persistence:persistence-provider />
change will not be a simple addition with the current source. If the code was similar to
the JPA redesign started in trunk it would be.
Here is the problem.
The provider is a single component which gets installed (hibernate, or generic) during
initialization. After that there is no other provider available. I added the
persistence-provider element to the persistence-2.0.xsd and could add it to the
components.xml. The problem is that because the provider is only determined during init I
would have to add very specific code to the Initialization class to check this element and
override the other values. I did not like putting that code there - seemed forced.
If the code was more like what the provider redesign in trunk then this would be a field
in the PersistenceProvider and the check would be easy.
I think that we should wait and do this with the other changes that we talked about for a
later release (JBSEAM-2785).
I'm going to commit the docs from before with a note that it is a workaround. If we
do end changing this I'll just update the doc (its small).
seam 2.0's persistence:managed-persistence-context not support
openjpa
----------------------------------------------------------------------
Key: JBSEAM-1946
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1946
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.GA
Environment: tomacat 6+ myfaces 1.2.0 + seam 2.0 ga+ spring 2.0.6 + openjpa
0.9.7
Reporter: clf clf
Assigned To: Jay Balunas
Fix For: 2.0.2.GA
I try to test the Seam's compatibility with openjpa.
The web project is tomacat + myfaces + seam + spring jpa + openjpa.
I define entityManagerFactory in the application.xml
[code]
<!-- JPA EntityManagerFactory -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
</property>
<property name="jpaVendorAdapter">
<!--
<bean
class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
<property name="databasePlatform"
value="org.springframework.samples.petclinic.toplink.EssentialsHSQLPlatformWithNativeSequence"/>
<property name="showSql" value="true"/>
</bean>
-->
<!--
<bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="HSQL"/>
<property name="showSql" value="true"/>
</bean>
-->
<bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
<property name="database" value="HSQL"/>
<property name="showSql" value="true"/>
</bean>
</property>
</bean>
[/code]
And Define managed-persistence-context in component.xml
[code]
<persistence:managed-persistence-context name="courseEntityManager"
entity-manager-factory="#{entityManagerFactory}"
auto-create="true" />
[/code]
The Web Project reports Error
[code]
2007-09-21 09:21:09,981 ERROR [org.jboss.seam.jsf.SeamPhaseListener] - <uncaught
exception>
java.lang.RuntimeException: could not proxy delegate
at
org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:102)
Caused by: java.lang.ClassCastException:
org.apache.openjpa.persistence.EntityManagerImpl
at
org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:98)
[/code]
I also test seam with toplink and hibernate,and find toplink fail,hibernate success
It seems to me that seam's persistence:managed-persistence-context only supports
hibernate as entity-manager-factory
and not supports other jpa implementation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira