You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jason Dyer <jd...@bluetarp.com> on 2006/01/11 21:12:33 UTC

problem with PropertySelection + Hibernate

I'm confused by an issue I'm having with PropertySelection and Hibernate, so 
I'd appreciate any insight into the problem.

Basically, I've got Hibernate and Tapestry playing together at least as much 
as I've been able to display and update data using the OpenSessionInView 
model as supported by hive-util (aka hivetranse.)

So far, so good, until I tried to create a PropertySelction component defined 
as:
  <component id="standingSelect" type="PropertySelection">
    <binding name="displayName" value="literal:Standing"/>
    <binding name="value" value="ognl:customer.standing"/>
    <binding name="model" value="ognl:customerStandingSelectionModel"/>
  </component>

where customer.standing is an object of type Standing, which should be loaded 
by Hibernate as part of a Customer object.  The 
CustomerStandingSelectionModel is an implementation of 
IPropertySelectionModel that takes a List<CustomerStanding> which is fetched 
via the CustomerStandingDao.

The selection list displays correctly--however, the value corresponding to the 
customer.standing property is never selected (no value is selected, in fact).   
The problem is that the customer.standing value never equals() any of the 
objects from the List<CustomerStanding>, despite the fact that it should be.

Most of the reading I've done suggests that problems like this can arise from 
using objects that are detached from the hibernate session, but both the 
Customer object and the CustomerStanding list are being loaded by the same 
session (I've verified this with the debugger.)

Does anyone have any idea what's going on here?  My understanding is that 
hibernate should be returning the same object for all references to the same 
database row (assuming the same session), but that just doesn't seem to be 
happening.  Has anyone else run into this problem?

TIA,
-Jason

(Sorry about the long post, which might be better asked on the Hibernate 
lists, but it seems like such a common operation under Tapestry that someone 
here might have run into it...)

-- 
SHIFT TO THE LEFT!
SHIFT TO THE RIGHT!
POP UP, PUSH DOWN,
BYTE, BYTE, BYTE!
--------------
Jason Dyer
BlueTarp Financial, inc.

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