Commit/rollback using querydsl sql

415 views
Skip to first unread message

Nono

unread,
Dec 17, 2015, 2:49:17 AM12/17/15
to Querydsl
Hello

I'm looking at querydsl for a simple standalone project, with just 2 tables.

However, I need some transactional request to achieve something close to this pseudo code:
int max = select max(index) from tableA where  topic = "foo";
insert into tableB values (... , index = max +1);

I don't see how I can use jdbc commit/rollback, apart from falling back to the sql string and doing it myself.

What am I missing ?

thanks in advance

Best regards and thx for querydsl :)
nono

Filipe Sousa

unread,
Dec 17, 2015, 4:53:09 AM12/17/15
to Querydsl
Take a look at examples that implement the transactional part.

Nono

unread,
Dec 30, 2015, 5:20:34 PM12/30/15
to Querydsl
Thanks for the hint Filipe

I actually plan to create a TransactionalDataSource wrapping a real one, the gist of the idea can be seen there https://gist.github.com/anonymous/29262201a65e9f1c36da

Do it looks sensible to you ?

Thanks again

best regards
nono

timowest

unread,
Jan 6, 2016, 5:50:39 AM1/6/16
to Querydsl
Is this DataSource supposed to be threadsafe? If yes, you should use a ThreadLocal to hold the connection.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages