-
1. Re: why ejb function is trying to flush?
joblini Dec 4, 2008 4:15 AM (in response to rodrigotico)Hi Rodrigo,
You should call Persist before running the Query in pressButton.
-
2. Re: why ejb function is trying to flush?
joblini Dec 4, 2008 4:22 AM (in response to rodrigotico)You are querying the same collection (Person) which contains the transient instance, right? So what should the entityManager do? Overwrite your transient instance? Looks like it is reminding you to save it before doing the Query ...
-
3. Re: why ejb function is trying to flush?
rodrigotico Dec 4, 2008 6:51 AM (in response to rodrigotico)Hi ingo, thanks for reply!
I just used
from Person
on pressButton query as an example, but a query on any other entity does the same behavior.Actually, there is a lot of workarounds that I can use, flush the session before run the query is one, don't set person.getOrder().add(o) at that moment is another.
But what I am trying to understand is if this is the expected behavior.
I don't think so, because the conversation is in manual flushmode and I am using seam managed persistence context and a seam transaction manager (ejb-transaction).
I don't understand why Seam is trying to flush. Do you?
Thanks!
-
4. Re: why ejb function is trying to flush?
rodrigotico Dec 11, 2008 10:38 PM (in response to rodrigotico)Hi!
Please, someone can explain this behavior? Is the expected?
Thanks
-
5. Re: why ejb function is trying to flush?
rodrigotico Dec 17, 2008 6:24 PM (in response to rodrigotico)Hi again! Anyone could help me with this question?
-
6. Re: why ejb function is trying to flush?
joblini Dec 18, 2008 9:06 AM (in response to rodrigotico)Hi Rodrigo,
Please refer to the following documentation, I think that it explains why flush is being called.
3.9. Flush the persistence context 3.9.1. In a transaction From time to time the entity manager will execute the SQL DML statements needed to synchronize the data store with the state of objects held in memory. This process, flush, occurs by default (this is Hibernate specific and not defined by the specification) at the following points: * before query execution* * from javax.persistence.EntityTransaction.commit()* * when EntityManager.flush() is called* (*) if a transaction is active
-
7. Re: why ejb function is trying to flush?
rodrigotico Dec 18, 2008 3:23 PM (in response to rodrigotico)yeah!!! Thanks very much for the perfect answer. I didn't know that hibernate
flushs the entity manager before any query!I know this is a JPA/Hibernate issue, but i think this should be explained on seam reference doc (chapter 9.2. Seam managed transactions).
I created a new jira JBSEAM-3857