i got to my goal. i got a configuration where persisting works
first of all persisting did only work with option a), where code gets executed inside transaction-callback:
further more there seem to be hsqldb issues. persisting was only successful when i used the hsqldb database server option with network stack (url pattern jdbc:hsqldb:hsql://localhost/xdb). using file based version without network stack (url pattern jdbc:hsqldb:file:testdb) failed, even when combined with transaction-callback pattern (see above).Code:public void saveOrUpdate(final Object obj) { BeanFactory.getTransactionTemplate().execute(new TransactionCallback(){ public Object doInTransaction(TransactionStatus status) { hibernateTemplate.saveOrUpdate(obj); return null; } }); }
besides: though the code does not get really readable (through anonymous classes), it is at least encapsulated in one single method. let's hope in future, closures will be included in java language....



Reply With Quote