我正在运行包含以下组件的应用程序:
在从Web控制器到服务层的每个请求中(使用Spring的@Transactional注释),我注意到对于Hibernate在事务内部的服务调用期间执行的每个SQL查询,都会从jndi DataSource请求新的DataSource连接. Hibernate的ConnectionProvider,直到DataSource用完了空闲连接并最终挂起.
以下是配置的一部分:
弹簧:
<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)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)服务
@Transactional(readOnly=true) @Service
public class MyServiceImpl implements MyService …Run Code Online (Sandbox Code Playgroud)我正在尝试使用联合数据类型支持的成员记录类型来构建 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)