You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christopher Yates <CA...@co.stark.oh.us> on 2005/03/01 15:43:48 UTC

Tapestry's OGNL with Hibernate

Hello,
 
My Tapestry application's model layer uses Hibernate for persistence. 
My view record page is passed an entity object which was populated with
hibernate.  The problem is that for any fields that are null in the
database, Hibernate makes them null in the class and then I get a
ognlException, "Unable to resolve expression".
 
For example,  MyClass.variable may be null, but ognl displays it fine
either way.
But, if MyClass.AnotherClass.variable is null, ognl bombs out.
 
What is the best, most elegant, least coding required, way to deal with
this?  Thank you.
 
-
Chris Yates
Stark County Data Center
330-451-7432 x4405

Re: Tapestry's OGNL with Hibernate

Posted by David Solis <h....@gmail.com>.
We use something like this:

          <tr height="20" jwcid="@Conditional" condition="ognl:
account.regimen != null" element="tr">
           <th class="titlecell"><font class="title">Regimen</font></th>
           <td class="normalcell" colspan="3"><font
class="normal">&nbsp;<span jwcid="@Insert" value="ognl:
account.regimen">MANCOMUNADA</span></font></td>
          </tr>

Regards

D.


On Tue, 01 Mar 2005 09:43:48 -0500, Christopher Yates
<CA...@co.stark.oh.us> wrote:
> Hello,
> 
> My Tapestry application's model layer uses Hibernate for persistence.
> My view record page is passed an entity object which was populated with
> hibernate.  The problem is that for any fields that are null in the
> database, Hibernate makes them null in the class and then I get a
> ognlException, "Unable to resolve expression".
> 
> For example,  MyClass.variable may be null, but ognl displays it fine
> either way.
> But, if MyClass.AnotherClass.variable is null, ognl bombs out.
> 
> What is the best, most elegant, least coding required, way to deal with
> this?  Thank you.
> 
> -
> Chris Yates
> Stark County Data Center
> 330-451-7432 x4405
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Tapestry's OGNL with Hibernate

Posted by Jonny Wray <jo...@yahoo.com>.
You're saying the in accessing a.b.c b is null and therefore bombs?

OGNL has a mechanism for dealing with this. You register a null handler with
the ognl runtime in an init routine. I think the registration is a static
method of Ognl.

I generally find it is easier to deal with this at the data level (ensure b
cannot be null) but in the cases that can't be done, the ognl mechanism
works well.


On 3/1/05 6:43 AM, "Christopher Yates" <CA...@co.stark.oh.us> wrote:

> Hello,
> 
> My Tapestry application's model layer uses Hibernate for persistence.
> My view record page is passed an entity object which was populated with
> hibernate.  The problem is that for any fields that are null in the
> database, Hibernate makes them null in the class and then I get a
> ognlException, "Unable to resolve expression".
> 
> For example,  MyClass.variable may be null, but ognl displays it fine
> either way.
> But, if MyClass.AnotherClass.variable is null, ognl bombs out.
> 
> What is the best, most elegant, least coding required, way to deal with
> this?  Thank you.
> 
> -
> Chris Yates
> Stark County Data Center
> 330-451-7432 x4405
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org