Guys,
I'm trying to jooq in a project with many concurrent web requests and I
found really strange behaviour for simple finder methods. There is my code
and test for testng
@Override
public UserBlock findById(int userId, int friendId) {
UserBlockRecord record = using(config).fetchOne(USER_BLOCK,
byId(userId, friendId));
return ((record == null) ? null : record.into(UserBlock.class));
}
@Test(threadPoolSize = 10, invocationCount = 100)
public void concurrencyForFinder() {
new TransactionTemplate(transactionManager).execute(new
TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus
status) {
final Random random = new Random();
userBlockDao.findById(random.nextInt(100), random.nextInt(100));
}
});
}
And here is how it is crashing
org.jooq.exception.DataAccessException: SQL [select
`user_block`.`user_id`, `user_block`.`friend_id`, `user_block`.`created_time`,
`user_block`.`is_block` from `user_block` where (`user_block`.`user_id` = 87
and `user_block`.`friend_id` = 5)]; Connection is broken: "session closed"
[90067-173]
at org.jooq.impl.Utils.translate(Utils.java:1158)
at
org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:495)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:325)
at
org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:344)
at
org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:335)
at org.jooq.impl.SelectImpl.fetchLazy(SelectImpl.java:1044)
at
org.jooq.impl.DefaultDSLContext.fetchLazy(DefaultDSLContext.java:1778)
at org.jooq.impl.DefaultDSLContext.fetchOne(DefaultDSLContext.java:1758)
at ***********.UserBlockDaoImpl.findById(UserBlockDaoImpl.java:48)
I'm using Spring to couple everything together so there is my xml
<bean id="pooledDataSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="org.h2.Driver"/>
<property name="url"
value="jdbc:h2:mem:testdb;LOCK_TIMEOUT=30000;MVCC=true;DB_CLOSE_DELAY=-1;MODE=MySQL;INIT=RUNSCRIPT
FROM 'classpath:database/init_schema.sql';"/>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<property name="targetDataSource"
ref="pooledDataSource" />
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="jooqConfig" class="org.jooq.impl.DefaultConfiguration">
<constructor-arg index="0">
<bean class="org.jooq.impl.DataSourceConnectionProvider">
<constructor-arg ref="dataSource" />
</bean>
</constructor-arg>
<constructor-arg index="1"><null /></constructor-arg>
<constructor-arg index="2"><null /></constructor-arg>
<constructor-arg index="3"><null /></constructor-arg>
<constructor-arg index="4"><null /></constructor-arg>
<constructor-arg index="5"><value
type="org.jooq.SQLDialect">MYSQL</value></constructor-arg>
<constructor-arg index="6">
<bean class="org.jooq.conf.Settings">
<property name="renderSchema" value="false" />
<property name="statementType" value="STATIC_STATEMENT" />
</bean>
</constructor-arg>
<constructor-arg index="7"><null /></constructor-arg>
</bean>
Is it somethign wrong with my config or I faced with a bug?
Thank you,
Alex.
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.