にロールバックされませんこの1:取引は、私は非常によく似ているコードを持ってJOOQ
dslContext.transaction(new TransactionalRunnable()
{
@Override
public void run(Configuration arg0) throws Exception
{
dao1.insert(object1);
//Object 1 is inserted in the database
//despite the exception that is being thrown
if(true)
throw new RuntimeException();
dao2.insert(object2)
}
});
これは私がDSLのコンテキストを作成するために使用していたコードとで生成されたDAOSですJOOQ。
ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource();
comboPooledDataSource.setDriverClass(org.postgresql.Driver.class.getName());
comboPooledDataSource.setJdbcUrl("jdbc:postgresql://localhost:5432/database?searchpath=schema");
comboPooledDataSource.setUser("user");
comboPooledDataSource.setPassword("password");
comboPooledDataSource.setMinPoolSize(5);
comboPooledDataSource.setAcquireIncrement(5);
comboPooledDataSource.setMaxPoolSize(25);
Configuration configuration=new DefaultConfiguration().set(comboPooledDataSource).set(
SQLDialect.POSTGRES);
DSLContext dslContext=DSL.using(configuration);
Dao1 dao1=new Dao1(configuration);
Dao2 dao2=new Dao2(configuration);
なぜこの現象が発生しますか?
'私はこの1つに非常によく似ているコードがありますか? – PeterMmm
あなたはどのjOOQバージョンを使用していますか? 'comboPooledDataSource'の設定方法を教えてください。 –
@ LukasEder私はJOOQのバージョン3.9.1を使用しています。質問を更新しました。 – Thunder