return (counter > 1 ? pb2 : pb1);
}
};
assertTrue("Hasn't thread broker", !TransactionSynchronizationManager.hasResource(tm.getPbKey()));
final TransactionTemplate tt = new TransactionTemplate(tm);
tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
tt.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
assertTrue("Has thread broker", TransactionSynchronizationManager.hasResource(tm.getPbKey()));
assertEquals(pb1, OjbFactoryUtils.getPersistenceBroker(tm.getPbKey(), false));
tt.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
assertTrue("Has thread broker", TransactionSynchronizationManager.hasResource(tm.getPbKey()));
assertEquals(pb2, OjbFactoryUtils.getPersistenceBroker(tm.getPbKey(), false));
}
});