this is an Development check. if you use deployment mode you wont see this.
In the current head this is fixed/improved and it will not be called anymore
from onDetach
and it wont be called anymore that often because the check for if it is
needed to check for it is much better
johan
On Tue, Mar 25, 2008 at 2:44 PM, Charlie Dobbie <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've recently upgraded a 1.2.6 application to 1.3.1. This involved
> simultaneously upgrading libraries for Wicket, Databinder and Hibernate to
> name but three, so until my application settles, I'll never be sure which
> library is causing each issue!
>
> I'm getting the following exception in my logs on development, but not
> deployment:
>
> 25-Mar-2008 12:56:21 org.apache.wicket.RequestCycle detach
> SEVERE: there was an error cleaning up target
>
> [EMAIL PROTECTED]
> [Page
> class = flow.pages.internal.job.ViewJob, id = 1, version =
> 0]->newDuplicationTaskLink->interface
> org.apache.wicket.markup.html.link.ILinkListener.ILinkListener (request
> paramaters: [RequestParameters componentPath=1:newDuplicationTaskLink
> pageMapName=null versionNumber=0 interfaceName=ILinkListener
> componentId=null behaviorId=null urlDepth=-1 parameters={}
> onlyProcessIfPathActive=false]).
> org.hibernate.PropertyValueException: not-null property references a null
> or
> transient value: flow.data.DuplicationTask.description
> at org.hibernate.engine.Nullability.checkNullability(Nullability.java
> :72)
> [...snip...]
> at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
> at flow.pages.internal.job.ViewJob$9.isVisible(ViewJob.java:219)
> at org.apache.wicket.Component.renderHead(Component.java:2528)
> at org.apache.wicket.markup.html.WebPage$1.component(WebPage.java:432)
> at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java
> :821)
> at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java
> :836)
> at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java
> :861)
> at org.apache.wicket.markup.html.WebPage.onDetach(WebPage.java:425)
> at org.apache.wicket.Component.detach(Component.java:1075)
> at org.apache.wicket.request.target.component.PageRequestTarget.detach(
> PageRequestTarget.java:80)
> at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1046)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1334)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
> at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java
> :354)
> at org.apache.wicket.protocol.http.WicketFilter.doFilter(
> WicketFilter.java:194)
> at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
> ServletHandler.java:1084)
> [...snip...]
>
>
> I think my problem might be related to the onDetach method in WebPage. In
> this method, if there is an HtmlHeaderContainer, and if the application is
> in development mode, it visits all the components on the page and calls
> renderHead on each.
>
> I do not understand the intention behind that at all. Can anyone explain
> why it is doing what it is doing, and how I can avoid this Exception?
>
> Charlie.
>
>
>
> More detailed information if required:
>
> I have a page (ViewJob) which which has a Link whose onClick calls:
>
> HibernateObjectModel jobModel =
>
> (HibernateObjectModel)((IChainingModel)ViewJob.this.getModel()).getChainedModel();
> WebPage responsePage = new NewDuplicationTask(jobModel);
> setResponsePage(responsePage);
>
> The constructor of the NewDuplicationTask page extracts the Job from the
> passed jobModel and calls duplicationTask.setJob(job). The
> DuplicationTask
> that it holds has a "description" property, which is initially null and is
> populated via a required field on the NewDuplicationTask page. However,
> the
> above Exception complaining about a null description property occurs at
> page
> display, way before the form could have been submitted. The Exception
> thrown is pointing to an isVisible check, on the page that the user has
> just
> left.
>
> The renderHead call mentioned above calls isVisible, and in my case I have
> a
> component whose visibility depends on whether or not a Job already exists
> in
> the database with the same "job number". I believe this check is causing
> Hibernate to attempt to flush the Job back to the database, which then
> causes the Exception because the DuplicationTask that has just been added
> to
> the in-memory Job hasn't been completed yet. And certainly shouldn't be
> flushed to the database until the Submit button is finally pressed!
>