[jboss-user] [JBoss Seam] - Re: Changes not persisted using EntityHome

gzoller do-not-reply at jboss.com
Mon Apr 9 14:32:08 EDT 2007


It seems like overkill--and its a bit hard to describe w/o seeing it or the following struggles I've had trying to accomplish this very simple operation.

In a nutshell if I do it exactly like the tutorial I get an java.lang.UnsupportedOperationException.  This is because my list comes from my entity's list, which happens to be a Hibernate PersistentBag.  While PersistentBag does implement remove(), whatever AbstractList that happens to be used internally within PersistentBag when my program runs does not, so I get this exception.  (If PersistenBag always used a backing List that supported remove() then I think I'd be ok here.)

Rather than use the Hibernate-generated list directly if I make a copy of this list into an ArrayList then I get exceptions about trying to em.remove() a detached object when I go to delete it.  So to fix that I use the entityHome object to find a new (attached) copy but then I get this exception when I remove it: javax.persistence.EntityNotFoundException: deleted entity passed to persist.  I have no idea what its complaining about here and started feeling I was beating my head against a wall.

So my solution seems like overkill but it does indeed work.  I wish a simpler solution worked, but so far I haven't found one.

Greg

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035784



More information about the jboss-user mailing list