Closed GoogleCodeExporter closed 9 years ago
In my application I'll change executeQuery() to execute() for now, since it
isn't really clear whether using executeQuery() to get the next sequence value
should be allowed or not. In any case, the behavior of H2 in this particular
scenario should be consistent (always succeed or always fail) regardless of
locking scheme or connection idleness.
Original comment by noslowerdna@gmail.com
on 14 Apr 2011 at 10:52
Hi,
I'm afraid it's not so easy to fix this problem. One solution would be to
automatically switch to 'write' mode, and re-run the query in this case. This
would require a few changes in JDBC code. I'm not sure if this is a very
important use case, so I will not implement it. Instead, I will document the
limitation, and add a feature request to to roadmap.
Therefore, I will change the status to 'in roadmap' (because priorities are
tracked there).
Regards,
Thomas
Original comment by thomas.t...@gmail.com
on 15 May 2011 at 4:00
Thanks for the update. That sounds good. I've switched to AUTO_SERVER=TRUE, so
am no longer affected by this bug.
Original comment by noslowerdna@gmail.com
on 16 May 2011 at 10:26
Hello,
I use an ORM (Hibernate) to access the H2 database and can't figure out how to
use execute() instead of executeQuery() then. Does any one know how to handle
this situation ?
The SERIALIZED locking is the only way for us to allow concurrent access
without installing a H2 server on the machine that hosts the database. We try
to provide zero data administration for the users of our application : they
only have to care about a directory where the data resides and most of the
time, there is no concurrent access and they even don't know where data is
stored.
If there is no workaround in this context, I would really appreciate that this
issue is reopened. Thomas, maybe you could tell me what H2 code you would have
changed and I could test a patch even if it is not commited in an official
release ?
Thank you
Regards,
Laurent
Original comment by lrichard...@gmail.com
on 10 Aug 2011 at 10:52
See https://groups.google.com/d/msg/h2-database/igbPHNQjL4g/BewqmHdmA84J for a
proposed patch that works fine on H2 1.3.158 in my use case. The switch to
write mode is targeted only on the retrieving of the sequence value and the
overhead applies only to SERIALIZED file_lock.
Original comment by lrichard...@gmail.com
on 20 Aug 2011 at 9:51
Hi,
In your patch, 'beforeWriting' is called too late (see where it is called
otherwise). I have now implemented a solution however, it is already committed.
Could you check if it works for you (you need to build H2 yourself using the
source code in the trunk).
Regards,
Thomas
Original comment by thomas.t...@gmail.com
on 21 Aug 2011 at 7:02
Thank you very very much Thomas.
I just built the trunk to test it in my application and everything works fine.
This definitely makes H2 my database of choice to embed.
Your responsiveness is greatly appreciated.
Best regards,
Laurent
Original comment by lrichard...@gmail.com
on 21 Aug 2011 at 7:34
Original issue reported on code.google.com by
noslowerdna@gmail.com
on 14 Apr 2011 at 10:40