Hi people. Time has come for my second question on this group :)

I created a helper method to create a link to delete a JPA entity.

    def deleteLink[T <: AnyRef](clazz : Class[T], id : Long, dest :
String, link : NodeSeq, model : LocalEMF with RequestVarEM) = {
        SHtml.link(dest, () => {
                try {
                    model.removeAndFlush(model.getReference(clazz,
id))
                    notice("Succesfully deleted!")
                } catch {
                    case ee : EntityExistsException =>
                        logAndError("Entity exists! Maybe object has
children?", ee)
                    case pe : PersistenceException =>
                        logAndError("Persistence exception", pe)
                    case e : Throwable =>
                        logAndError("Some strange exception happened",
e)
                } finally {
                    S.redirectTo(dest)
                }
            }, link)
    }

The link works fine, the entity is deleted from the database and
"Succesfully deleted!" notice is shown but an exception happens in the
finally block when calling S.redirectTo(dest).

The idea is to enable user to provide a callback (in the finally part)
to determine to what page to redirect after deleting an entity (maybe
as a function of weather deletion was successful) and this is only a
prototype but it doesn't work for some reason.

Any idea what could be causing this? I have SHtml.links in other
simpler places that have redirectTo and there it works.

Thanks in advance :)

PS I really love lift, it is really a refreshing framework.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to