> (3) reading from that ResultSet
Do you mean doTask4()? The following code
tx.commit();
session.close();
session = sessionFactory.openSession();
commits the session, and then opens it again (in a new connection,
perhaps). The other thread (doTask3()) just reads from another session
(connection?). There is some pooling involved, so I'm not sure if
session=connection here.
On Tuesday, November 20, 2012 4:02:33 PM UTC+2, Noel Grandin wrote:
>
> Judging from the code paths involved, your code is
>
> (1) opening a ResultSet
> (2) calling commit() on that connection
> (3) reading from that ResultSet
>
> which is illegal.
>
> In general, multi-thread apps should be using one connection per thread.
>
> From experience, I can tell you that Hibernate is not a good match for a
> desktop-style multi-threaded application (I build lots of them).
>
> For that reason, we use SimpleORM as our mapping layer to the database.
>
> On 2012-11-16 22:33, Nick99 wrote:
>
> Okay, it seems I've isolated the source of missing lobs/LOB NPEs/missing
> lob entry problems. At this point I cannot attach a compilable project,
> just the test code and the trace log.
>
> Environment:
> 2-core CPU
> Java x32 1.6.27
> h2-1.3.169 (*embedded*)
> c3p0-0.9.1.2
> hibernate-core-3.6.10
> spring 3.1.2
>
> The test cases creates an instance of a certain db-mapped class. The
> class contains a CLOB field along with some dummy field.
> The test then starts 2 threads: the first one is reading the instance
> periodically, the other is updating it (periodically too). The CLOB field
> is not updated - the issue seems to not depend on it.
> After about 1-5s of test run something bad happens (NPE/missing LOB/etc).
>
> *I'm attaching the trace log (lvl 3), the database (state: the java
> process was stopped from IDE after the exception), the test case. *The
> db2.zip is the same stuff but with the failure happening almost immediately
> after start.
>
> The test case requires some initial Spring/Hibernate/C3P0 configuration
> (e.g. hibernate.hbm2ddl.auto=update, etc), so if that's too much - I can to
> create a standalone project with all the deps included & send it. It may
> also be possible to recreate the test using plain JDBC, not the full Spring
> stack.
>
> HTH; this (or similar) issue seems to be pretty popular recently.
>
> Thank you.
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/d9jyaefh7XsJ.
> To post to this group, send email to [email protected]<javascript:>
> .
> To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/r4zaoJQuX6YJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.