i also had a proxy having a reference to a proxy and it worked because of store.
could you please post the stack trace of your problem ?
jakob
Edson Carlos Ericksson Richter wrote:
That was what I thinked... But what if my object contains a Collection of proxies that should be updated too? And that proxies has a (proxied) reference to the main object?
This is the reason I've to put that line...
See sample repository.xml:
<class-descriptor class="br.com.mgr.beans.BeanA" proxy="dynamic" schema="MGR" table="TB_A"> <field-descriptor name="id" column="ID" jdbc-type="VARCHAR" primarykey="true" autoincrement="false" /> <field-descriptor name="description" column="DS" jdbc-type="VARCHAR" /> <collection-descriptor name="allB"
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareList" element-class-ref="br.com.mgr.beans.BeanA" proxy="true" auto-update="true" auto-delete="true"> <orderby name="id" sort="DESC"/> <inverse-foreignkey field-ref="idA"/> </collection-descriptor> </class-descriptor>
<class-descriptor class="br.com.mgr.beans.BeanB" proxy="dynamic" schema="MGR" table="TB_B"> <field-descriptor name="idA" column="ID_A" jdbc-type="VARCHAR" primarykey="true" autoincrement="false" /> <field-descriptor name="idB" column="ID_B" primarykey="true" jdbc-type="VARCHAR" /> <field-descriptor name="value" column="VL" jdbc-type="DOUBLE" /> <reference-descriptor name="a" proxy="true" class-ref="br.com.mgr.beans.BeanA"> <foreignkey field-ref="idA"/> </reference-descriptor> </class-descriptor>
In this case, when assertFk is called, the beanB object is a proxy, that cama from a collection proxy inside beanA, and beanA is not a proxy anymore. This is the research I've done.
Maybe I'm wrong, but why my app works fine if I don't use proxies for the collection? And why, when debugging, NetBeans shows that beanB in assertFk IS a proxy? If the change I've done should not be there, then it should be in other place - I don't know where. But it is needed. I'm using a non-modified CVS HEAD obtained today (about 3 hours ago).
Please, double check it...
Edson Richter
----- Original Message ----- From: "Jakob Braeuchi" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Friday, July 04, 2003 5:18 PM
Subject: Re: Dynamic proxies and references Help
hi edson,
this may help, but afaik a proxy is always converted into a real object before assertFkAssignment() is called. see store()
// ProxyObjects only have to be updated if their real subjects have been loaded obj = ProxyHelper.getRealObjectIfMaterialized(obj);
jakob
Edson Carlos Ericksson Richter wrote:
I trying some advanced config in my app, and I've found same problem.Appear
that AssertFkAssignment is missing converting Proxy to Objects.
I've tried to change the line
fld.getPersistentField().set(obj, refPkValues[i]);
to
fld.getPersistentField().set(ProxyHelper.getRealObject(obj), refPkValues[i]);
in PersistenceBrokerImpl (line 737 in CVS HEAD). Now work for me, without changing behaviour in rest of my app.
Jakob, Thomas, can you verify/confirm that? And if yes, can you fix this in CVS?
Thanks,
Edson Richter
----- Original Message ----- From: "Marcus Breese" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 24, 2003 6:04 PM
Subject: Dynamic proxies and references Help
Is it possible to have recursive references while using a dynamic proxy?
For example, I have a Project class where each project can track its parent project.
The class is laid out as such:
Project |- id |- name |- parentid |- parentidObject
Project has an interface IProject. Also, Id, Name and parentid are inherited from a base class.
I can retrieve the Project fine via a dynamic proxy, but when I try to get the parentIdObject, I get the following error:
13:52:49,838 - ERROR org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl - while set field: object class[ edu.iupui.cmg.labratj.om.Project target field: parentIdObject target field type: interface edu.iupui.cmg.labratj.om.IProject object value class: $Proxy5 object value: Name: Test Project Id: 1 PiId: 1 ]
Can anyone see where I'm going wrong?
-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=- Marcus Breese [EMAIL PROTECTED] IU School of Medicine [EMAIL PROTECTED] Dept. of Biochemistry and Molecular Biology Center for Medical Genomics / Grow Lab
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.495 / Virus Database: 294 - Release Date: 30/6/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.495 / Virus Database: 294 - Release Date: 30/6/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
