[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-418) many-to-one relationship; proxy returned instead of the object

Nico De Groote (JIRA) noreply at atlassian.com
Fri Dec 1 08:29:04 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-418?page=comments#action_25527 ] 

Nico De Groote commented on HHH-418:
------------------------------------

Same problem here.... we sometimes get a proxy returned instead of the desired object?  

> many-to-one relationship; proxy returned instead of the object
> --------------------------------------------------------------
>
>          Key: HHH-418
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-418
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.0.1
>  Environment: Hibernate 3.0.1, Ingres 
>     Reporter: Carwin Zimmermann

>
>
> We have recently upgraded from hibernate 2 to 3 and am getting inconsistent behaviour when using a many-to-one relationship. 
> The data model consists of an account with transactions. There are many transactions in each account which is mapped as follows:
> <class name="wms.model.ac.water.AcWaterTransaction" table="ac_water_transaction" >
>  ...
>    <many-to-one name="AcWaterAccount" column="c_account_id" class="wms.model.ac.account.AcWaterAccount" />
>  ...
> When an AcWaterTransaction is retrieved and the AcWaterAccount object is accessed via the 'getter', instead of getting the actual AcWaterAccount object, I get the proxy object called wms.model.ac.account.AcWaterAccount$$EnhancerByCGLIB$$9c0bd41f. All other many-to-one relationships in the same object behave in this manner.
> 	<many-to-one name="AcWaterAccount" column="c_account_id" class="wms.model.ac.account.AcWaterAccount">
> 	<many-to-one name="InCodeBalanceEffect" column="c_balance_effect_id" class="wms.model.in.code.InCode" />
> 	<many-to-one name="AcWaterProduct" column="c_product_id" class="wms.model.ac.water.AcWaterProduct" />
> 	<many-to-one name="MeMeterReading" column="c_meter_reading_id" class="wms.model.me.meter.MeMeterReading" />
> However, another identical relationship, used in the same way returns the expected object.
> 	<many-to-one name="BiChargeCat" column="c_charge_cat_id" class="wms.model.bi.charge.BiChargeCat" />
> All the loaded objects 
> The exact same configuration under hibernate 2.x (for both objects) works as expected - we are consistently returned the real object, never the proxy.
> So, Hibernate 3.x behaves differently to 2.x.  Secondly 3.x behaves inconsitently under that same circumstances.
> Irrespective of whether this is labeled a bug or a feature, it renders hibernate 3.x unusable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list