-
1. Re: Seam 2.2 + Jboss 4.2.3 : Using an alternative JPA provider instead of hibernate problem
mali_karabulut Nov 2, 2012 5:09 AM (in response to mali_karabulut)Here are some details about my configuration:
1. persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="pu">
<!--<provider>org.hibernate.ejb.HibernatePersistence</provider>-->
<provider>org.batoo.jpa.core.BatooPersistenceProvider</provider>
<jta-data-source>java:/myProjectDatasource</jta-data-source>
<properties>
<property name="org.batoo.jpa.ddl" value="NONE" />
<!--
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:myProjectEntityManagerFactory"/>
-->
</properties>
</persistence-unit>
</persistence>
2. components.xml (partially)
<component name="org.jboss.seam.persistence.persistenceProvider"
class="tr.com.bilisim.shgm.util.CustomBatooPersistenceProvider">
</component>
3.CustomBatooPersistenceProvider.java
package tr.com.bilisim.shgm.util;
import javax.persistence.EntityManager;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.persistence.PersistenceProvider;
//@Name("org.jboss.seam.persistence.persistenceProvider")
@Scope(ScopeType.STATELESS)
@BypassInterceptors
@Install(precedence= 10/*FRAMEWORK*/ , classDependencies={"javax.persistence.EntityManager"})
public class CustomBatooPersistenceProvider extends PersistenceProvider {
@Override
public void setFlushModeManual(EntityManager entityManager) {
// no-op
System.err.println("CustomBatooPersistenceProvider-setFlushModeManual");
}
}
4. JPA jar file placed in: (not sure where to place this jar file though)
jboss-4.2.3.GA\server\default\deploy\batoo-jpa-0.1.6.jar
jboss-4.2.3.GA\server\default\lib\batoo-jpa-0.1.6.jar
and also in my ear project (even tried 'Make Deployable' option for this jar file in eclipse)
myproject-ear\Ear Content\lib\batoo-jpa-0.1.6.jar
PS: My project was perfectly working with hibernate configuration, datasource definitions etc. (No problem at all. with previous configuration)