小编Gae*_*tan的帖子

WAS 6.1,JPA与JTA,Hibernate,Spring:数据检索问题

我正在运行包含以下组件的应用程序:

  • Oracle 9i
  • 带有WS和EJB3功能包的WAS 6.1.0.23
  • JPA与Hibernate 3.3.2.GA作为提供者(使用Hibernate-EntityManager 3.4.0)
  • WAS的Spring事务管理器:UowTransactionManager(spring 2.5.6)
  • 具有流管理持久性的Spring Webflow(2.0.8),即实体管理器被序列化到http会话中,并在每个请求上恢复.

在从Web控制器到服务层的每个请求中(使用Spring的@Transactional注释),我注意到对于Hibernate在事务内部的服务调用期间执行的每个SQL查询,都会从jndi DataSource请求新的DataSource连接. Hibernate的ConnectionProvider,直到DataSource用完了空闲连接并最终挂起.

以下是配置的一部分:

  1. 弹簧:

    <tx:annotation-driven />
    <context:component-scan base-package="org.home.myapp" />
    <jee:jndi-lookup id="dataSource" jndi-name="jdbc/DS" resource-ref="true"/>
    <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
    <bean id="EMF" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
      </property>
    </bean>
    
    Run Code Online (Sandbox Code Playgroud)
  2. persistence.xml中

    <persistence-unit name="persistence" transaction-type="JTA">
      <properties>
        <property name="hibernate.archive.autodetection" value="class"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9iDialect"/>
        <property name="hibernate.current_session_context_class" value="jta"/>
        <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
        <property name="hibernate.format_sql" value="true"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.default_batch_fetch_size" value="20"/>
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>   
      </properties>
    </persistence-unit>
    
    Run Code Online (Sandbox Code Playgroud)
  3. 服务

    @Transactional(readOnly=true) @Service
    public class MyServiceImpl implements MyService …
    Run Code Online (Sandbox Code Playgroud)

spring hibernate jpa jta websphere-6.1

6
推荐指数
1
解决办法
4496
查看次数

AVRO - 具有联合记录类型支持的复杂记录

我正在尝试使用联合数据类型支持的成员记录类型来构建 AVRO 的复杂记录。

{
    "namespace": "proj.avro",
    "protocol": "app_messages",
    "doc" : "application messages",
    
    "types": [
        {
            "name": "record_request",
            "type" : "record", 
            "fields": 
            [
                {
                    "name" : "request_id", 
                    "type" : "int"
                },
                {
                    "name" : "message_type",
                    "type" : int,
                },
                {
                    "name" : "users",
                    "type" : "string"
                }
            ]
        },
        {
            "name" : "request_response",
            "type" : "record",
            "fields" :
            [
                {
                    "name" : "request_id",
                    "type" : "int"
                },
                {
                    "name" : "response_code",
                    "type" : "string"
                },
                {
                    "name" : "response_count",
                    "type" : …
Run Code Online (Sandbox Code Playgroud)

python java avro

3
推荐指数
1
解决办法
7091
查看次数

标签 统计

avro ×1

hibernate ×1

java ×1

jpa ×1

jta ×1

python ×1

spring ×1

websphere-6.1 ×1