You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 17 Members of 9438 |
| Forum: Seam Users |
16. Apr 2010, 04:28 America/New_York | Link |
Is it possible to have one method start a transaction and another method finish it?
In the following I want add() to start the transaction and save to commit it, but the flushmode is not getting set at all and the record gets persisted at the end of add():
@Name("personPage")
@Scope(ScopeType.CONVERSATION)
@Transactional
public class PersonPage implements Serializable {
@Begin(join=true, flushMode=FlushModeType.MANUAL)
public void add() {
personHome.persist();
}
@End
public void save() {
personHome.getEntityManager().flush();
}
}
Are you using Hibernate as your JPA provider? I think that the manual flush mode only works if your provider is Hibernate
Yes
I do not see the details of your personHome.persist() i.e. if you override the EntityHome method and how... but in case this persist() on EntityHome is called then this explicitly calls getEntityManager().flush() which you wanted to call only in your save() method... so, you should not call persist() if you do not want to flush()...
Please do not forget to rate!
Gabor