You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br> on 2003/07/04 21:44:31 UTC

Re: Dynamic proxies and references Help

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" <ma...@breese.com>
To: <oj...@db.apache.org>
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                            mbreese@iupui.edu
IU School of Medicine              marcus@breese.com
Dept. of Biochemistry and Molecular Biology
Center for Medical Genomics / Grow Lab


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




---
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


Re: mixed: PB and ODMG

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Joerg,

----- Original Message -----
From: "Joerg Lensing" <in...@softcon-lensing.de>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, July 07, 2003 3:46 PM
Subject: mixed: PB and ODMG


> hello,
> in an earlier thread, there was a hint to use PB for "simple"
> activities, which need not
> odmg-transactions (and therefore better performance) and to use ODMG
for
> the more complex things. How should be the handling?

please see
http://db.apache.org/ojb/faq.html#15

> (How do i get the
> PersistenceBroker?

PersistenceBroker broker = ((HasBroker) tx).getBroker();

>Can there be more than one Transaction per thread?)

ODMG implementation currently does not support
nested tx, but you can use tx.join() to do something like

tx1.begin()
...
tx2.begin()
// do something
tx2.commit // tx2.abort()
...
tx1.join()
tx1.commit() // tx1.abort()

regards,
Armin

>
> Intended useage:
>
> 1. open odmg-transaction
> 2. make an independent read-update-write by PB (transaction will be
done
> in one go)
> 3. use odmg-transaction
> 4. make a second independetn read-update-write by BP
> 5. commit odmg-transaction
>
> an example would be nice
>
> joerg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>



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


mixed: PB and ODMG

Posted by Joerg Lensing <in...@softcon-lensing.de>.
hello,
in an earlier thread, there was a hint to use PB for "simple" 
activities, which need not
odmg-transactions (and therefore better performance) and to use ODMG for
the more complex things. How should be the handling? (How do i get the
PersistenceBroker? Can there be more than one Transaction per thread?)

Intended useage:

1. open odmg-transaction
2. make an independent read-update-write by PB (transaction will be done 
in one go)
3. use odmg-transaction
4. make a second independetn read-update-write by BP
5. commit odmg-transaction

an example would be nice

joerg



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


Re: Dynamic proxies and references Help

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
I've downloaded CVS Head again, and appear that it's working fine now (if I
have any other issue, I'll let you know).

Thanks!

Edson Richter

----- Original Message ----- 
From: "Jakob Braeuchi" <jb...@gmx.ch>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Saturday, July 05, 2003 6:28 AM
Subject: Re: Dynamic proxies and references Help


bad typo :( i meant 'now forces'

jakob

Jakob Braeuchi wrote:

> hi edson,
>
> imo assertFkAssignment no forces a proxy to be materialized although
> cascade-store is false.
> i'll check this asap.
>
> jakob
>
>
> Jakob Braeuchi wrote:
>
>> hi edson,
>>
>> now it's clear. otherObj in store collections is not converted into a
>> real object.
>> i fixed assertFkAssignment.
>>
>> jakob
>>
>>
>> Edson Carlos Ericksson Richter wrote:
>>
>>> Here go, with original (unmodified) OJB code:
>>>
>>> Message:
>>>
>>> org.apache.ojb.broker.metadata.MetadataException: Error invoking
>>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>>> declaring class
>>>
>>> Message in console (with stack trace - note that anObject is a
>>> proxy!!!):
>>>
>>> [DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl],
>>> java.lang.IllegalArgumentException
>>> [DEFAULT] ERROR: Declaring class
>>> [br.com.mgr.beans.financeiro.MoedaCotacaoBean]
>>> [DEFAULT] ERROR: Property Name [codigoMoeda]
>>> [DEFAULT] ERROR: Property Type [java.lang.String]
>>> [DEFAULT] ERROR: anObject was class [$Proxy5]
>>> [DEFAULT] ERROR: aValue was class [java.lang.String]
>>> [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO:
>>> Rollback was
>>> called, do rollback on current connection
>>> org.apache.commons.dbcp.PoolableConnection@f18d37
>>> br.com.mgr.brokers.exceptions.BrokerException:
>>> org.apache.ojb.broker.metadata.MetadataException: Error invoking
>>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>>> declaring class
>>>        at
>>>
br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>>> 551)
>>>        at
>>>
br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>>> 523)
>>>        at br.com.mgr.useCases.NavegavelUC.doStore(NavegavelUC.java:485)
>>>        at
>>>
br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.btnSaveAc
>>> tionPerformed(NavegacaoToolBar.java:533)
>>>        at
>>>
br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.access$70
>>> 0(NavegacaoToolBar.java:35)
>>>        at
>>>
br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar$FormListe
>>> ner.actionPerformed(NavegacaoToolBar.java:380)
>>>        at
>>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
>>>        at
>>>
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
>>> n.java:1839)
>>>        at
>>>
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
>>> 20)
>>>        at
>>> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>>>        at
>>>
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
>>> .java:245)
>>>        at
>>> java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
>>>        at java.awt.Component.processMouseEvent(Component.java:5100)
>>>        at java.awt.Component.processEvent(Component.java:4897)
>>>        at java.awt.Container.processEvent(Container.java:1569)
>>>        at java.awt.Component.dispatchEventImpl(Component.java:3615)
>>>        at java.awt.Container.dispatchEventImpl(Container.java:1627)
>>>        at java.awt.Component.dispatchEvent(Component.java:3477)
>>>        at
>>> java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
>>>        at
>>> java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
>>>        at
>>> java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
>>>        at java.awt.Container.dispatchEventImpl(Container.java:1613)
>>>        at java.awt.Window.dispatchEventImpl(Window.java:1606)
>>>        at java.awt.Component.dispatchEvent(Component.java:3477)
>>>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
>>>        at
>>>
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
>>> va:201)
>>>        at
>>>
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
>>> :151)
>>>        at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
>>>        at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
>>>        at
>>> java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>>> Caused by: org.apache.ojb.broker.metadata.MetadataException: Error
>>> invoking
>>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>>> declaring class
>>>        at
>>>
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>>> ersistentFieldPropertyImpl.java:119)
>>>        at
>>>
org.apache.ojb.broker.core.PersistenceBrokerImpl.assertFkAssignment(Persiste
>>> nceBrokerImpl.java:738)
>>>        at
>>>
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Persistenc
>>> eBrokerImpl.java:820)
>>>        at
>>>
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker
>>> Impl.java:1986)
>>>        at
>>>
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>>> .java:1868)
>>>        at
>>>
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>>> .java:660)
>>>        at
>>>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi
>>> stenceBroker.java:157)
>>>        at
>>>
br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>>> 544)
>>>        ... 29 more
>>> Caused by: java.lang.IllegalArgumentException: object is not an
>>> instance of
>>> declaring class
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>>> )
>>>        at
>>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>>> .java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:324)
>>>        at
>>>
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>>> ersistentFieldPropertyImpl.java:113)
>>>        ... 36 more
>>>
>>>
>>> That's all!
>>>
>>>
>>>
>>>
>>>
>>> ---
>>> 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: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


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




---
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Dynamic proxies and references Help

Posted by Jakob Braeuchi <jb...@gmx.ch>.
bad typo :( i meant 'now forces'

jakob

Jakob Braeuchi wrote:

> hi edson,
>
> imo assertFkAssignment no forces a proxy to be materialized although 
> cascade-store is false.
> i'll check this asap.
>
> jakob
>
>
> Jakob Braeuchi wrote:
>
>> hi edson,
>>
>> now it's clear. otherObj in store collections is not converted into a 
>> real object.
>> i fixed assertFkAssignment.
>>
>> jakob
>>
>>
>> Edson Carlos Ericksson Richter wrote:
>>
>>> Here go, with original (unmodified) OJB code:
>>>
>>> Message:
>>>
>>> org.apache.ojb.broker.metadata.MetadataException: Error invoking
>>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>>> declaring class
>>>
>>> Message in console (with stack trace - note that anObject is a 
>>> proxy!!!):
>>>
>>> [DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl],
>>> java.lang.IllegalArgumentException
>>> [DEFAULT] ERROR: Declaring class
>>> [br.com.mgr.beans.financeiro.MoedaCotacaoBean]
>>> [DEFAULT] ERROR: Property Name [codigoMoeda]
>>> [DEFAULT] ERROR: Property Type [java.lang.String]
>>> [DEFAULT] ERROR: anObject was class [$Proxy5]
>>> [DEFAULT] ERROR: aValue was class [java.lang.String]
>>> [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: 
>>> Rollback was
>>> called, do rollback on current connection
>>> org.apache.commons.dbcp.PoolableConnection@f18d37
>>> br.com.mgr.brokers.exceptions.BrokerException:
>>> org.apache.ojb.broker.metadata.MetadataException: Error invoking
>>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>>> declaring class
>>>        at
>>> br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>>> 551)
>>>        at
>>> br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>>> 523)
>>>        at br.com.mgr.useCases.NavegavelUC.doStore(NavegavelUC.java:485)
>>>        at
>>> br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.btnSaveAc
>>> tionPerformed(NavegacaoToolBar.java:533)
>>>        at
>>> br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.access$70
>>> 0(NavegacaoToolBar.java:35)
>>>        at
>>> br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar$FormListe
>>> ner.actionPerformed(NavegacaoToolBar.java:380)
>>>        at
>>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
>>>        at
>>> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
>>> n.java:1839)
>>>        at
>>> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
>>> 20)
>>>        at
>>> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>>>        at
>>> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
>>> .java:245)
>>>        at
>>> java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
>>>        at java.awt.Component.processMouseEvent(Component.java:5100)
>>>        at java.awt.Component.processEvent(Component.java:4897)
>>>        at java.awt.Container.processEvent(Container.java:1569)
>>>        at java.awt.Component.dispatchEventImpl(Component.java:3615)
>>>        at java.awt.Container.dispatchEventImpl(Container.java:1627)
>>>        at java.awt.Component.dispatchEvent(Component.java:3477)
>>>        at
>>> java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
>>>        at
>>> java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
>>>        at 
>>> java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
>>>        at java.awt.Container.dispatchEventImpl(Container.java:1613)
>>>        at java.awt.Window.dispatchEventImpl(Window.java:1606)
>>>        at java.awt.Component.dispatchEvent(Component.java:3477)
>>>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
>>>        at
>>> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
>>> va:201)
>>>        at
>>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
>>> :151)
>>>        at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
>>>        at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
>>>        at 
>>> java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>>> Caused by: org.apache.ojb.broker.metadata.MetadataException: Error 
>>> invoking
>>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>>> declaring class
>>>        at
>>> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>>> ersistentFieldPropertyImpl.java:119)
>>>        at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.assertFkAssignment(Persiste
>>> nceBrokerImpl.java:738)
>>>        at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Persistenc
>>> eBrokerImpl.java:820)
>>>        at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker
>>> Impl.java:1986)
>>>        at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>>> .java:1868)
>>>        at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>>> .java:660)
>>>        at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi
>>> stenceBroker.java:157)
>>>        at
>>> br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>>> 544)
>>>        ... 29 more
>>> Caused by: java.lang.IllegalArgumentException: object is not an 
>>> instance of
>>> declaring class
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>>> )
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>>> .java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:324)
>>>        at
>>> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>>> ersistentFieldPropertyImpl.java:113)
>>>        ... 36 more
>>>
>>>
>>> That's all!
>>>
>>>
>>>
>>>
>>>
>>> ---
>>> 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: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>  
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


Re: Dynamic proxies and references Help

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi edson,

imo assertFkAssignment no forces a proxy to be materialized although 
cascade-store is false.
i'll check this asap.

jakob


Jakob Braeuchi wrote:

> hi edson,
>
> now it's clear. otherObj in store collections is not converted into a 
> real object.
> i fixed assertFkAssignment.
>
> jakob
>
>
> Edson Carlos Ericksson Richter wrote:
>
>> Here go, with original (unmodified) OJB code:
>>
>> Message:
>>
>> org.apache.ojb.broker.metadata.MetadataException: Error invoking
>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>> declaring class
>>
>> Message in console (with stack trace - note that anObject is a 
>> proxy!!!):
>>
>> [DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl],
>> java.lang.IllegalArgumentException
>> [DEFAULT] ERROR: Declaring class
>> [br.com.mgr.beans.financeiro.MoedaCotacaoBean]
>> [DEFAULT] ERROR: Property Name [codigoMoeda]
>> [DEFAULT] ERROR: Property Type [java.lang.String]
>> [DEFAULT] ERROR: anObject was class [$Proxy5]
>> [DEFAULT] ERROR: aValue was class [java.lang.String]
>> [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: 
>> Rollback was
>> called, do rollback on current connection
>> org.apache.commons.dbcp.PoolableConnection@f18d37
>> br.com.mgr.brokers.exceptions.BrokerException:
>> org.apache.ojb.broker.metadata.MetadataException: Error invoking
>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>> declaring class
>>        at
>> br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>> 551)
>>        at
>> br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>> 523)
>>        at br.com.mgr.useCases.NavegavelUC.doStore(NavegavelUC.java:485)
>>        at
>> br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.btnSaveAc
>> tionPerformed(NavegacaoToolBar.java:533)
>>        at
>> br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.access$70
>> 0(NavegacaoToolBar.java:35)
>>        at
>> br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar$FormListe
>> ner.actionPerformed(NavegacaoToolBar.java:380)
>>        at
>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
>>        at
>> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
>> n.java:1839)
>>        at
>> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
>> 20)
>>        at
>> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>>        at
>> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
>> .java:245)
>>        at
>> java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
>>        at java.awt.Component.processMouseEvent(Component.java:5100)
>>        at java.awt.Component.processEvent(Component.java:4897)
>>        at java.awt.Container.processEvent(Container.java:1569)
>>        at java.awt.Component.dispatchEventImpl(Component.java:3615)
>>        at java.awt.Container.dispatchEventImpl(Container.java:1627)
>>        at java.awt.Component.dispatchEvent(Component.java:3477)
>>        at
>> java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
>>        at
>> java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
>>        at 
>> java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
>>        at java.awt.Container.dispatchEventImpl(Container.java:1613)
>>        at java.awt.Window.dispatchEventImpl(Window.java:1606)
>>        at java.awt.Component.dispatchEvent(Component.java:3477)
>>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
>>        at
>> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
>> va:201)
>>        at
>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
>> :151)
>>        at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
>>        at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
>>        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>> Caused by: org.apache.ojb.broker.metadata.MetadataException: Error 
>> invoking
>> method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>> declaring class
>>        at
>> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>> ersistentFieldPropertyImpl.java:119)
>>        at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.assertFkAssignment(Persiste
>> nceBrokerImpl.java:738)
>>        at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Persistenc
>> eBrokerImpl.java:820)
>>        at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker
>> Impl.java:1986)
>>        at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>> .java:1868)
>>        at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>> .java:660)
>>        at
>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi
>> stenceBroker.java:157)
>>        at
>> br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>> 544)
>>        ... 29 more
>> Caused by: java.lang.IllegalArgumentException: object is not an 
>> instance of
>> declaring class
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>> )
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>> .java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:324)
>>        at
>> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>> ersistentFieldPropertyImpl.java:113)
>>        ... 36 more
>>
>>
>> That's all!
>>
>>
>>
>>
>>
>> ---
>> 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: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>  
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


Re: Dynamic proxies and references Help

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi edson,

now it's clear. otherObj in store collections is not converted into a 
real object.
i fixed assertFkAssignment.

jakob


Edson Carlos Ericksson Richter wrote:

>Here go, with original (unmodified) OJB code:
>
>Message:
>
>org.apache.ojb.broker.metadata.MetadataException: Error invoking
>method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>declaring class
>
>Message in console (with stack trace - note that anObject is a proxy!!!):
>
>[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl],
>java.lang.IllegalArgumentException
>[DEFAULT] ERROR: Declaring class
>[br.com.mgr.beans.financeiro.MoedaCotacaoBean]
>[DEFAULT] ERROR: Property Name [codigoMoeda]
>[DEFAULT] ERROR: Property Type [java.lang.String]
>[DEFAULT] ERROR: anObject was class [$Proxy5]
>[DEFAULT] ERROR: aValue was class [java.lang.String]
>[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback was
>called, do rollback on current connection
>org.apache.commons.dbcp.PoolableConnection@f18d37
>br.com.mgr.brokers.exceptions.BrokerException:
>org.apache.ojb.broker.metadata.MetadataException: Error invoking
>method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>declaring class
>        at
>br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>551)
>        at
>br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>523)
>        at br.com.mgr.useCases.NavegavelUC.doStore(NavegavelUC.java:485)
>        at
>br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.btnSaveAc
>tionPerformed(NavegacaoToolBar.java:533)
>        at
>br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.access$70
>0(NavegacaoToolBar.java:35)
>        at
>br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar$FormListe
>ner.actionPerformed(NavegacaoToolBar.java:380)
>        at
>javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
>        at
>javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
>n.java:1839)
>        at
>javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
>20)
>        at
>javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>        at
>javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
>.java:245)
>        at
>java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
>        at java.awt.Component.processMouseEvent(Component.java:5100)
>        at java.awt.Component.processEvent(Component.java:4897)
>        at java.awt.Container.processEvent(Container.java:1569)
>        at java.awt.Component.dispatchEventImpl(Component.java:3615)
>        at java.awt.Container.dispatchEventImpl(Container.java:1627)
>        at java.awt.Component.dispatchEvent(Component.java:3477)
>        at
>java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
>        at
>java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
>        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
>        at java.awt.Container.dispatchEventImpl(Container.java:1613)
>        at java.awt.Window.dispatchEventImpl(Window.java:1606)
>        at java.awt.Component.dispatchEvent(Component.java:3477)
>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
>        at
>java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
>va:201)
>        at
>java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
>:151)
>        at
>java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
>        at
>java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
>        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>Caused by: org.apache.ojb.broker.metadata.MetadataException: Error invoking
>method:setCodigoMoeda in object:$Proxy5: object is not an instance of
>declaring class
>        at
>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>ersistentFieldPropertyImpl.java:119)
>        at
>org.apache.ojb.broker.core.PersistenceBrokerImpl.assertFkAssignment(Persiste
>nceBrokerImpl.java:738)
>        at
>org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Persistenc
>eBrokerImpl.java:820)
>        at
>org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker
>Impl.java:1986)
>        at
>org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>.java:1868)
>        at
>org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
>.java:660)
>        at
>org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi
>stenceBroker.java:157)
>        at
>br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
>544)
>        ... 29 more
>Caused by: java.lang.IllegalArgumentException: object is not an instance of
>declaring class
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>)
>        at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:324)
>        at
>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
>ersistentFieldPropertyImpl.java:113)
>        ... 36 more
>
>
>That's all!
>
>
>
>
>
>---
>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: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>


Re: Dynamic proxies and references Help

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
Here go, with original (unmodified) OJB code:

Message:

org.apache.ojb.broker.metadata.MetadataException: Error invoking
method:setCodigoMoeda in object:$Proxy5: object is not an instance of
declaring class

Message in console (with stack trace - note that anObject is a proxy!!!):

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl],
java.lang.IllegalArgumentException
[DEFAULT] ERROR: Declaring class
[br.com.mgr.beans.financeiro.MoedaCotacaoBean]
[DEFAULT] ERROR: Property Name [codigoMoeda]
[DEFAULT] ERROR: Property Type [java.lang.String]
[DEFAULT] ERROR: anObject was class [$Proxy5]
[DEFAULT] ERROR: aValue was class [java.lang.String]
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback was
called, do rollback on current connection
org.apache.commons.dbcp.PoolableConnection@f18d37
br.com.mgr.brokers.exceptions.BrokerException:
org.apache.ojb.broker.metadata.MetadataException: Error invoking
method:setCodigoMoeda in object:$Proxy5: object is not an instance of
declaring class
        at
br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
551)
        at
br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
523)
        at br.com.mgr.useCases.NavegavelUC.doStore(NavegavelUC.java:485)
        at
br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.btnSaveAc
tionPerformed(NavegacaoToolBar.java:533)
        at
br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar.access$70
0(NavegacaoToolBar.java:35)
        at
br.com.mgr.formularios.componentes.barraNavegacao.NavegacaoToolBar$FormListe
ner.actionPerformed(NavegacaoToolBar.java:380)
        at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
        at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
n.java:1839)
        at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
20)
        at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
.java:245)
        at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
        at java.awt.Component.processMouseEvent(Component.java:5100)
        at java.awt.Component.processEvent(Component.java:4897)
        at java.awt.Container.processEvent(Container.java:1569)
        at java.awt.Component.dispatchEventImpl(Component.java:3615)
        at java.awt.Container.dispatchEventImpl(Container.java:1627)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
        at java.awt.Container.dispatchEventImpl(Container.java:1613)
        at java.awt.Window.dispatchEventImpl(Window.java:1606)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:201)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:151)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Error invoking
method:setCodigoMoeda in object:$Proxy5: object is not an instance of
declaring class
        at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
ersistentFieldPropertyImpl.java:119)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.assertFkAssignment(Persiste
nceBrokerImpl.java:738)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Persistenc
eBrokerImpl.java:820)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker
Impl.java:1986)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
.java:1868)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl
.java:660)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi
stenceBroker.java:157)
        at
br.com.mgr.brokers.ojbBroker.GeneralBrokerImpl.store(GeneralBrokerImpl.java:
544)
        ... 29 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of
declaring class
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
ersistentFieldPropertyImpl.java:113)
        ... 36 more


That's all!





---
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


Re: Dynamic proxies and references Help

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi edson,

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" <jb...@gmx.ch>
>To: "OJB Users List" <oj...@db.apache.org>
>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" <ma...@breese.com>
>>To: <oj...@db.apache.org>
>>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                            mbreese@iupui.edu
>>IU School of Medicine              marcus@breese.com
>>Dept. of Biochemistry and Molecular Biology
>>Center for Medical Genomics / Grow Lab
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>>
>>---
>>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: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>---
>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: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>


Re: Dynamic proxies and references Help

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
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" <jb...@gmx.ch>
To: "OJB Users List" <oj...@db.apache.org>
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" <ma...@breese.com>
>To: <oj...@db.apache.org>
>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                            mbreese@iupui.edu
>IU School of Medicine              marcus@breese.com
>Dept. of Biochemistry and Molecular Biology
>Center for Medical Genomics / Grow Lab
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>---
>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: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>


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




---
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


Re: Dynamic proxies and references Help

Posted by Jakob Braeuchi <jb...@gmx.ch>.
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" <ma...@breese.com>
>To: <oj...@db.apache.org>
>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                            mbreese@iupui.edu
>IU School of Medicine              marcus@breese.com
>Dept. of Biochemistry and Molecular Biology
>Center for Medical Genomics / Grow Lab
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>---
>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: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>