在Seam2 / Tomcat7环境中了解与JPA / Hibernate的连接池/事务

时间:2012-08-31 17:01:53

标签: java hibernate transactions connection-pooling seam2


看到这3个文件,我得出结论:
1)此应用程序使用JPA和Hibernate作为提供程序?!
2)连接池由tomcat(context.xml)控制?!
3)交易怎么样? Seamframework容器控制交易吗?或者没有交易控制器!? 4)如果2)为真,那么如果我想将该连接池换成hibernate的C3PO,那么这个变化的影响会是多少呢?

(((components.xml)))

<persistence:entity-manager-factory name="entityManagerFactory" persistence-unit-name="sampleDatabase" />
<persistence:managed-persistence-context entity-manager-factory="#{entityManagerFactory}" name="entityManager" />
<factory auto-create="true" name="hibernateSession" value="#{entityManager.delegate}" />
<transaction:entity-transaction entity-manager="#{entityManager}" />

(((persistence.xml)))

<persistence-unit name="sampleDatabase">
    <non-jta-data-source>java:comp/env/sampleDatasource</non-jta-data-source>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
        <property name="hibernate.jdbc.batch_size" value="20"/>
        <property name="hibernate.connection.provider_class" value="com.sample.util.RoleProvider" />
    </properties>
</persistence-unit>

(((context.xml)))

<Resource auth="Container"
          name="sampleDatasource"
          type="javax.sql.DataSource"
          driverClassName="oracle.jdbc.driver.OracleDriver"
          maxActive="2"
          maxIdle="1"
          username="sample"
          password="sample"
          url="jdbc:oracle:thin:@myserver:1521:DESENV" />

0 个答案:

没有答案