"lightbulb432" wrote : "petemuir" wrote : My best guess as to why it fails from 
what you've said is that by passing the instance through the datamodel like 
that it has become unmanaged so cannot be removed - you can check this by 
calling entityManager.contains().  Setting by Id rather than instance might 
just work (use it with my.getId rather than rowIndex).
  | 
  | Where should I set the breakpoint in my debugger to do an 
entityManager.contains() check?
  | 
  | Or if it's better to output a FacesMessage with this value, where should I 
put that debugging line?

I don't think there is anywhere really existing in EntityHome you can put that. 
 So I guess you could subclass EntityHome and override remove and do it there.  
Or if you are really clever with your debugger you should be able to get it to 
run to evaluate that line without it being in your code ;)


anonymous wrote : anonymous wrote : And beware of the fact that a remove won't 
remove the entity from memory - it just detaches it from the persistence 
context.
  | 
  | So the refreshed page after the delete would still show the removed entity 
in the list right? But if I look in my DB, am I correct to say I should no 
longer see it there (if things work correctly) even though it's still in memory?
  | 
  | Next question is why does this happen - isn't entity-query EVENT-scoped, 
which means that on the next refresh it doesn't exist and has to hit the DB 
again?
  | 
  | Thanks a lot.

It might do - it depends on how your contexts are set up, whether you refresh 
your lists etc.  But yes, it should no longer be in the db.

IIRC EntityQuery is conversation scoped.  So you would need to use 
removeFromStatefulContexts to ensure it is refreshed I think...

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017761#4017761

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017761
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to