[jboss-user] [JBoss Seam] - Re: What's wrong with this components.xml / persistence.xml
fernando_jmt
do-not-reply at jboss.com
Mon Mar 12 17:13:17 EDT 2007
Ok, I will describe what I have in my configuration files when I deploy to Tomcat.
1.- My components.xml
|
| <core:managed-persistence-context name="entityManager" auto-create="true"
| persistence-unit-jndi-name="java:/myappEntityManagerFactory"/>
|
2.- My persistence.xml
| <persistence-unit name="myappPU">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/myappDatasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="update"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| <!-- These are the default for JBoss EJB3, but not for HEM: -->
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/myappEntityManagerFactory"/>
| </properties>
| </persistence-unit>
|
3.- META-INF jboss-beans.xml
| <bean name="myappDatasourceBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
| <property name="driverClass">com.mysql.jdbc.Driver</property>
| <property name="connectionURL">jdbc:mysql://192.168.10.1:3306/myapp</property>
| <property name="userName"><value class="java.lang.String">fernando</value></property>
| <property name="password"><value class="java.lang.String">fernando</value></property>
| <property name="jndiName">java:/myappDatasource</property>
| <property name="minSize">0</property>
| <property name="maxSize">10</property>
| <property name="blockingTimeout">1000</property>
| <property name="idleTimeout">100000</property>
| <property name="transactionManager"><inject bean="TransactionManager"/></property>
| <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
| <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
| </bean>
|
| <bean name="myappDatasource" class="java.lang.Object">
| <constructor factoryMethod="getDatasource">
| <factory bean="myappDatasourceBootstrap"/>
| </constructor>
| </bean>
|
|
HTH.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027339#4027339
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027339
More information about the jboss-user
mailing list