[JBoss Seam] - Re: EntityManager: For newbies or to close gaps in your know
by toni
@bf081
I found another thing you forgot to mention:
anonymous wrote : You even don't have to call the merge() method since the entities never get DETACHED. So you might ask what is the "normal" (transaction scoped) persistence context good for?
One of the disatvantages of using an extended persistent context is that the transaction lasts for a long time, which is maybe not what you want.
If you go into the extreme case, then it might span until the user finally logs out. If during this time an error occurs, then all other actions will be undone.
Which makes me wonder, when and how a transaction finally is commited in an extended persistent context? I mean which of the statefull session beans do we have to destroy, if many are involved in the transaction.
I guess by ending the conversation using @End, wer surely destroy all SFSB and the current extended persistent manager, thereby commiting the current transaction. Is that correct? Maybe somebody can contribute to what I have said?
@justinwalsh
I have a question regarding:
anonymous wrote : The SMPC takes the concept of an EPC a little further by integrating the JSF lifecycle with that of the stateful component. Effectively what the SMPC achieves is the removal of LIE when traversing objects outside the scope of your session bean (there's more to it than that - but for now that will do). So in your JSF, if you traversed the customer --> addresses relationship (after outjecting a customer object) you'll avoid the LIE issue.
Does that mean that the the Entity will still be attached to the persistent manager or will it be unattached, but modified in such a way that calls to uninitialzed values will not generate LIE's?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990277#3990277
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990277
18Â years
[JBoss Seam] - Bidirectional OneToMany removal of related entities
by ngeadah
If I have a bidirectional OneToMany and I remove a related entity from the Set, then call "persist", is the removed related entity supposed to get deleted from the database or not? In my case it is not getting deleted, altough I was under the impression that persist would reflect all changes made to the object graph (my cascade is "ALL"). The removal from the Set is definitely occuring - it's just not getting reflected in the DB.
some code to explain:
Parent:
| @OneToMany(mappedBy="form", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
| public Set<BaseSchedule> getSchedules()
| {
| return schedules;
| }
|
Child:
| @ManyToOne
| public BaseForm getForm()
| {
| return form;
| }
|
Removal code:
|
| form.getSchedules().remove(someSchedule);
| em.persist(form); // This is NOT deleting the child
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990276#3990276
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990276
18Â years