Hi,
How can I generate a "SELECT FOR UPDATE" SQL query using querydsl-sql?
Thanks,
Gili
timowestYou can use the MySQLQuery class and call for forUpdate() or alternatively use the following invocation in SQLQueryImpl
query.addFlag(Position.END, "\nfor update ");
cowwoc
Hi Timo,
I'm using H2 so I'm afraid this won't help me. I ended
up using READ_REPEATED transaction isolation as a workaround for now. Is
it possible to introduce this feature into the API in a portable way?
Or is it too database-specific and I should file a specific RFE for H2
support?
I'm also beginning to think that I'm better off using
READ_REPEATED transaction isolation than SELECT ... for UPDATE because
when I need to establish a read-lock on a table, I tend to need to do
the same for the remaining tables (which READ_REPEATED does for me
automatically).
Thanks,
Gili
timowest
You should manage transaction isolation levels outside of Querydsl queries.
If
you need this on a per query basis than you probably need to get in
contact with the H2 guys, if something similar is not yet available.
cowwoc
Timo,
I believe you misunderstood me. I was saying that H2 *does*
support SELECT ... FOR UPDATE but that the H2 dialect in Querydsl did
not.
That being said, I don't need it for now because I decided to use READ_REPEATED transaction isolation for now.
Gili
timowest
If the H2 syntax for Select for update is similar to that of MySQL, you can use the addFlag code I posted.