D
david.karr
I'm using Hibernate 3.0.5, JDK 1.4.2, and WebLogic 8.1.4.
I discovered something odd in how a Hibernate query was behaving.
also queries any existing mapped objects in memory, which have not
been created in the database yet.
Before I started my test case, I used SQLDeveloper to verify that my
particular table was empty. My test case code first "new"s a bunch of
objects that are mapped to this table through Hibernate, but I only
put each one of them into a list. After that loop, I executed a
Hibernate query on that table, in order to delete the rows that it
finds. Surprisingly, the query didn't return 0 rows. It appeared to
return results for the objects that I had just created, but had not
persisted. After that code, it's supposed to persist those "new"ed
objects into the database. Unfortunately, in my test case, it never
gets there, because the transaction times out after executing the
"delete" statements for the allegedly existing rows.
I then rearranged my code so that the query for delete runs first, and
then it goes through the loop that "new"s the objects and then later
persists those. With the code in this order, it works fine.
Is this along the lines of expected behavior? I'm still trying to
understand the ramifications of this.
I discovered something odd in how a Hibernate query was behaving.
Hibernate query executes, it doesn't just query the database, but itFrom what I can tell, the behavior makes me think that when a
also queries any existing mapped objects in memory, which have not
been created in the database yet.
Before I started my test case, I used SQLDeveloper to verify that my
particular table was empty. My test case code first "new"s a bunch of
objects that are mapped to this table through Hibernate, but I only
put each one of them into a list. After that loop, I executed a
Hibernate query on that table, in order to delete the rows that it
finds. Surprisingly, the query didn't return 0 rows. It appeared to
return results for the objects that I had just created, but had not
persisted. After that code, it's supposed to persist those "new"ed
objects into the database. Unfortunately, in my test case, it never
gets there, because the transaction times out after executing the
"delete" statements for the allegedly existing rows.
I then rearranged my code so that the query for delete runs first, and
then it goes through the loop that "new"s the objects and then later
persists those. With the code in this order, it works fine.
Is this along the lines of expected behavior? I'm still trying to
understand the ramifications of this.