-
1. Re: Should I use EntityHome at all??
wilczarz.wilczarz.gmail.com Oct 1, 2008 12:58 PM (in response to chrisc)EntityManager used by EntityHome probably uses FlushModeType.AUTO by default. If you were using the MANUAL mode, the data would be written to database only after calling entityManager.flush() (in your case getEntityManager().flush()). So what you need to do is add getEntityManager().setFlushMode( FlushModeType.MANUAL ) (or getPersistenceContext().setFlushMode( FlushModeType.MANUAL )). I think it would be ok to put this into constructor because I doubt the entityManager gets injected by the interceptor in case of EntityHome.
-
2. Re: Should I use EntityHome at all??
joblini Oct 2, 2008 3:00 AM (in response to chrisc)Another way to resolve this is to add the following to the page descriptor (page.xml)
<begin-conversation flush-mode="MANUAL" join="true" />
-
3. Re: Should I use EntityHome at all??
chrisc Oct 2, 2008 9:44 AM (in response to chrisc)Thanks Tomasz. Even though for some strange reason MANUAL was not supported as a JPA supported option, your idea to change the flush mode was spot on. We instead used the seam annotation in our seam scope to switch the flush mode to manual in our EntityHome.
@Begin(flushMode=FlushModeType.MANUAL)
public void create() {
super.create();
}
Looks like this has done the trick and our JSF is no longer causing persists to the database until we have properly flushed.
Very clever.
Thanks,
Chris. -
4. Re: Should I use EntityHome at all??
chrisc Oct 2, 2008 9:50 AM (in response to chrisc)At the moment, we prefer to keep the flush mode setting within the EntityHome itself, but knowing this other way to set the flush mode to MANUAL should come in pretty handy for the future.
Thanks Ingo.