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 Maksimenko Alexander <ma...@bird.cris.net> on 2003/04/12 16:54:07 UTC

Proxy for java.util.Set

Hi! 
I want to persist followed object :

public class User{
  private java.util.Set roleSet;    
}

This is the part of my repository.xml 

 <collection-descriptor
  name="roleSet"
  element-class-ref="core.Role"
  indirection-table="USER_ROLE"
  proxy="true"
  auto-update="true"
 >
While materialization, OJB attempts to set roleSet property by org.apache.ojb.broker.accesslayer.ListProxy instance and so org.apache.ojb.broker.metadata.MetadataException arises. 
How can I solve this problem?


Re: Proxy for java.util.Set

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

the short answer is : no.
but it's not too complicated to implement a SetProxy in a future release.

jakob

Maksimenko Alexander wrote:

>Hi!
>That's the problem.
>In my case some of the proxied attributes are lists and other are sets!
>I want to use both lists and sets as proxied attributes. Can I do this?
>
>  
>
>>hi alexander,
>>
>>when you want to use SetProxy _all_ proxied attributes mus be Sets !
>>listPropery in your class User must be a Set.
>>remeber, the type of the proxy is defined globally.
>>
>>jakob
>>
>>Maksimenko Alexander wrote:
>>
>>    
>>
>>>Exception occurs when OJB tries set other list property by SetProxy
>>>      
>>>
>object
>  
>
>>>org.apache.ojb.broker.metadata.MetadataException: Error setting
>>>field:listProperty in object:ojbtest.User
>>>at
>>>      
>>>
>>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(P
>>    
>>
>e
>  
>
>>>rsistentFieldDefaultImpl.java:165)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollection(Per
>>    
>>
>s
>  
>
>>>istenceBrokerImpl.java:1065)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollections(Pe
>>    
>>
>r
>  
>
>>>sistenceBrokerImpl.java:1137)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Persistenc
>>    
>>
>e
>  
>
>>>BrokerImpl.java:1539)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByIdentity(Pe
>>    
>>
>r
>  
>
>>>sistenceBrokerImpl.java:1642)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByQuery(Persi
>>    
>>
>s
>  
>
>>>tenceBrokerImpl.java:1676)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getObjectByQuery
>>    
>>
>(
>  
>
>>>DelegatingPersistenceBroker.java:274)
>>>at
>>>      
>>>
>>core.persistence.ojb.PersistenceBrokerOJBImpl.getPersistence(PersistenceBro
>>    
>>
>k
>  
>
>>>erOJBImpl.java:30)
>>>
>>>Caused by: java.lang.IllegalArgumentException
>>>at
>>>      
>>>
>>sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl
>>    
>>
>.
>  
>
>>>java:63)
>>>at java.lang.reflect.Field.set(Field.java:519)
>>>at
>>>      
>>>
>>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(P
>>    
>>
>e
>  
>
>>>rsistentFieldDefaultImpl.java:147)
>>>
>>>----- Original Message -----
>>>
>>>
>>>      
>>>
>>>>hi alexander,
>>>>
>>>>what kind of exception and where ?
>>>>
>>>>jakob
>>>>
>>>>
>>>>Maksimenko Alexander wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Yes.But if I specify this property
>>>>>CollectionProxyClass=ProxySet
>>>>>Exception will appear when I'll  materialize collection property that
>>>>>extends java.util.List!
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>hi alexander,
>>>>>>
>>>>>>this class can be defined in ojb.properities and therefore is valid
>>>>>>            
>>>>>>
>for
>  
>
>>>>>>all collection proxies.
>>>>>>
>>>>>>hth
>>>>>>jakob
>>>>>>
>>>>>>Maksimenko Alexander wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Hi !
>>>>>>>Yes.I have exetnted CollectionProxy by SetProxy. The question is How
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>can
>>>
>>>
>>>      
>>>
>>>>>>>              
>>>>>>>
>>>>>I
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>force PersistenceBroker to use this SetProxy class for
>>>>>>>              
>>>>>>>
>materialization
>  
>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>one
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>of object properties. At the same time I want to be able to use
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>ListProxy
>>>
>>>
>>>      
>>>
>>>>>>>for other object properties.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>hi aleksander,
>>>>>>>>
>>>>>>>>why don't you extent CollectionProxy ?
>>>>>>>>that's the way i implemented ListProxy.
>>>>>>>>
>>>>>>>>jakob
>>>>>>>>
>>>>>>>>
>>>>>>>>Maksimenko Alexander wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>Thanks for your answer!
>>>>>>>>>But I can't understand the following.
>>>>>>>>>As far as I see the method
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyC
>>>>>          
>>>>>
>l
>  
>
>>>>>>            
>>>>>>
>>>a
>>>
>>>
>>>      
>>>
>>>>>>>              
>>>>>>>
>>>>>s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>s
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>>(Class collectionClass) can return either ListProxy or
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>CollectionProxy
>>>
>>>
>>>      
>>>
>>>>>>>>>classes. ?
>>>>>>>>>As far as I see  if I specify CollectionProxyClass=SetProxy
>>>>>>>>>                  
>>>>>>>>>
>property
>  
>
>>>>>>>>>                  
>>>>>>>>>
>>>in
>>>
>>>
>>>      
>>>
>>>>>>>>>OJB.properties file then SetProxy have extend ListProxy class. I
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>don't
>>>
>>>
>>>      
>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>like
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>>this approach.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implemen
>>>>>          
>>>>>
>t
>  
>
>>>>>>            
>>>>>>
>>>i
>>>
>>>
>>>      
>>>
>>>>>>>              
>>>>>>>
>>>>>n
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>g
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>>%201:n%20associations
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>>>Maksimenko Alexander wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>>>>>>>>Hi!
>>>>>>>>>>>I want to persist followed object :
>>>>>>>>>>>
>>>>>>>>>>>public class User{
>>>>>>>>>>>private java.util.Set roleSet;
>>>>>>>>>>>}
>>>>>>>>>>>
>>>>>>>>>>>This is the part of my repository.xml
>>>>>>>>>>>
>>>>>>>>>>><collection-descriptor
>>>>>>>>>>>name="roleSet"
>>>>>>>>>>>element-class-ref="core.Role"
>>>>>>>>>>>indirection-table="USER_ROLE"
>>>>>>>>>>>proxy="true"
>>>>>>>>>>>auto-update="true"
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>While materialization, OJB attempts to set roleSet property by
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
>>>>>>>>>org.apache.ojb.broker.metadata.MetadataException arises.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>>>>How can I solve this problem?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>---------------------------------------------------------------------
>>>>>>>>                
>>>>>>>>
>>>>>>>>>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
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>---------------------------------------------------------------------
>>>>>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
>>
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>


Re: Proxy for java.util.Set

Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Hi!
That's the problem.
In my case some of the proxied attributes are lists and other are sets!
I want to use both lists and sets as proxied attributes. Can I do this?

> hi alexander,
>
> when you want to use SetProxy _all_ proxied attributes mus be Sets !
> listPropery in your class User must be a Set.
> remeber, the type of the proxy is defined globally.
>
> jakob
>
> Maksimenko Alexander wrote:
>
> >Exception occurs when OJB tries set other list property by SetProxy
object
> >
> >org.apache.ojb.broker.metadata.MetadataException: Error setting
> >field:listProperty in object:ojbtest.User
> > at
>
>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(P
e
> >rsistentFieldDefaultImpl.java:165)
> > at
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollection(Per
s
> >istenceBrokerImpl.java:1065)
> > at
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollections(Pe
r
> >sistenceBrokerImpl.java:1137)
> > at
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Persistenc
e
> >BrokerImpl.java:1539)
> > at
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByIdentity(Pe
r
> >sistenceBrokerImpl.java:1642)
> > at
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByQuery(Persi
s
> >tenceBrokerImpl.java:1676)
> > at
>
>org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getObjectByQuery
(
> >DelegatingPersistenceBroker.java:274)
> > at
>
>core.persistence.ojb.PersistenceBrokerOJBImpl.getPersistence(PersistenceBro
k
> >erOJBImpl.java:30)
> >
> >Caused by: java.lang.IllegalArgumentException
> > at
>
>sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl
.
> >java:63)
> > at java.lang.reflect.Field.set(Field.java:519)
> > at
>
>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(P
e
> >rsistentFieldDefaultImpl.java:147)
> >
> >----- Original Message -----
> >
> >
> >>hi alexander,
> >>
> >>what kind of exception and where ?
> >>
> >>jakob
> >>
> >>
> >>Maksimenko Alexander wrote:
> >>
> >>
> >>
> >>>Yes.But if I specify this property
> >>>CollectionProxyClass=ProxySet
> >>>Exception will appear when I'll  materialize collection property that
> >>>extends java.util.List!
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>hi alexander,
> >>>>
> >>>>this class can be defined in ojb.properities and therefore is valid
for
> >>>>all collection proxies.
> >>>>
> >>>>hth
> >>>>jakob
> >>>>
> >>>>Maksimenko Alexander wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi !
> >>>>>Yes.I have exetnted CollectionProxy by SetProxy. The question is How
> >>>>>
> >>>>>
> >can
> >
> >
> >>>>>
> >>>>>
> >>>I
> >>>
> >>>
> >>>
> >>>
> >>>>>force PersistenceBroker to use this SetProxy class for
materialization
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>one
> >>>
> >>>
> >>>
> >>>
> >>>>>of object properties. At the same time I want to be able to use
> >>>>>
> >>>>>
> >ListProxy
> >
> >
> >>>>>for other object properties.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>hi aleksander,
> >>>>>>
> >>>>>>why don't you extent CollectionProxy ?
> >>>>>>that's the way i implemented ListProxy.
> >>>>>>
> >>>>>>jakob
> >>>>>>
> >>>>>>
> >>>>>>Maksimenko Alexander wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Thanks for your answer!
> >>>>>>>But I can't understand the following.
> >>>>>>>As far as I see the method
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
>
>>>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyC
l
> >>>>
> >>>>
> >a
> >
> >
> >>>>>
> >>>>>
> >>>s
> >>>
> >>>
> >>>
> >>>
> >>>>>>
> >>>>>>
> >>>>>s
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>(Class collectionClass) can return either ListProxy or
> >>>>>>>
> >>>>>>>
> >CollectionProxy
> >
> >
> >>>>>>>classes. ?
> >>>>>>>As far as I see  if I specify CollectionProxyClass=SetProxy
property
> >>>>>>>
> >>>>>>>
> >in
> >
> >
> >>>>>>>OJB.properties file then SetProxy have extend ListProxy class. I
> >>>>>>>
> >>>>>>>
> >don't
> >
> >
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>like
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>this approach.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
>
>>>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implemen
t
> >>>>
> >>>>
> >i
> >
> >
> >>>>>
> >>>>>
> >>>n
> >>>
> >>>
> >>>
> >>>
> >>>>>>
> >>>>>>
> >>>>>g
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>%201:n%20associations
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Maksimenko Alexander wrote:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>Hi!
> >>>>>>>>>I want to persist followed object :
> >>>>>>>>>
> >>>>>>>>>public class User{
> >>>>>>>>>private java.util.Set roleSet;
> >>>>>>>>>}
> >>>>>>>>>
> >>>>>>>>>This is the part of my repository.xml
> >>>>>>>>>
> >>>>>>>>><collection-descriptor
> >>>>>>>>>name="roleSet"
> >>>>>>>>>element-class-ref="core.Role"
> >>>>>>>>>indirection-table="USER_ROLE"
> >>>>>>>>>proxy="true"
> >>>>>>>>>auto-update="true"
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>While materialization, OJB attempts to set roleSet property by
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
> >>>>>>>org.apache.ojb.broker.metadata.MetadataException arises.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>>How can I solve this problem?
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
>
>>>>>>>---------------------------------------------------------------------
> >>>>>>>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
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>---------------------------------------------------------------------
> >>>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
>
>



Re: Proxy for java.util.Set

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

when you want to use SetProxy _all_ proxied attributes mus be Sets !
listPropery in your class User must be a Set.
remeber, the type of the proxy is defined globally.

jakob

Maksimenko Alexander wrote:

>Exception occurs when OJB tries set other list property by SetProxy object
>
>org.apache.ojb.broker.metadata.MetadataException: Error setting
>field:listProperty in object:ojbtest.User
> at
>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Pe
>rsistentFieldDefaultImpl.java:165)
> at
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollection(Pers
>istenceBrokerImpl.java:1065)
> at
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollections(Per
>sistenceBrokerImpl.java:1137)
> at
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Persistence
>BrokerImpl.java:1539)
> at
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByIdentity(Per
>sistenceBrokerImpl.java:1642)
> at
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByQuery(Persis
>tenceBrokerImpl.java:1676)
> at
>org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getObjectByQuery(
>DelegatingPersistenceBroker.java:274)
> at
>core.persistence.ojb.PersistenceBrokerOJBImpl.getPersistence(PersistenceBrok
>erOJBImpl.java:30)
>
>Caused by: java.lang.IllegalArgumentException
> at
>sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.
>java:63)
> at java.lang.reflect.Field.set(Field.java:519)
> at
>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Pe
>rsistentFieldDefaultImpl.java:147)
>
>----- Original Message -----
>  
>
>>hi alexander,
>>
>>what kind of exception and where ?
>>
>>jakob
>>
>>
>>Maksimenko Alexander wrote:
>>
>>    
>>
>>>Yes.But if I specify this property
>>>CollectionProxyClass=ProxySet
>>>Exception will appear when I'll  materialize collection property that
>>>extends java.util.List!
>>>
>>>
>>>
>>>      
>>>
>>>>hi alexander,
>>>>
>>>>this class can be defined in ojb.properities and therefore is valid for
>>>>all collection proxies.
>>>>
>>>>hth
>>>>jakob
>>>>
>>>>Maksimenko Alexander wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi !
>>>>>Yes.I have exetnted CollectionProxy by SetProxy. The question is How
>>>>>          
>>>>>
>can
>  
>
>>>>>          
>>>>>
>>>I
>>>
>>>
>>>      
>>>
>>>>>force PersistenceBroker to use this SetProxy class for materialization
>>>>>
>>>>>
>>>>>          
>>>>>
>>>one
>>>
>>>
>>>      
>>>
>>>>>of object properties. At the same time I want to be able to use
>>>>>          
>>>>>
>ListProxy
>  
>
>>>>>for other object properties.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>hi aleksander,
>>>>>>
>>>>>>why don't you extent CollectionProxy ?
>>>>>>that's the way i implemented ListProxy.
>>>>>>
>>>>>>jakob
>>>>>>
>>>>>>
>>>>>>Maksimenko Alexander wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Thanks for your answer!
>>>>>>>But I can't understand the following.
>>>>>>>As far as I see the method
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyCl
>>>>        
>>>>
>a
>  
>
>>>>>          
>>>>>
>>>s
>>>
>>>
>>>      
>>>
>>>>>>            
>>>>>>
>>>>>s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>(Class collectionClass) can return either ListProxy or
>>>>>>>              
>>>>>>>
>CollectionProxy
>  
>
>>>>>>>classes. ?
>>>>>>>As far as I see  if I specify CollectionProxyClass=SetProxy property
>>>>>>>              
>>>>>>>
>in
>  
>
>>>>>>>OJB.properties file then SetProxy have extend ListProxy class. I
>>>>>>>              
>>>>>>>
>don't
>  
>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>like
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>this approach.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implement
>>>>        
>>>>
>i
>  
>
>>>>>          
>>>>>
>>>n
>>>
>>>
>>>      
>>>
>>>>>>            
>>>>>>
>>>>>g
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>%201:n%20associations
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>Maksimenko Alexander wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>Hi!
>>>>>>>>>I want to persist followed object :
>>>>>>>>>
>>>>>>>>>public class User{
>>>>>>>>>private java.util.Set roleSet;
>>>>>>>>>}
>>>>>>>>>
>>>>>>>>>This is the part of my repository.xml
>>>>>>>>>
>>>>>>>>><collection-descriptor
>>>>>>>>>name="roleSet"
>>>>>>>>>element-class-ref="core.Role"
>>>>>>>>>indirection-table="USER_ROLE"
>>>>>>>>>proxy="true"
>>>>>>>>>auto-update="true"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>While materialization, OJB attempts to set roleSet property by
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
>>>>>>>org.apache.ojb.broker.metadata.MetadataException arises.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>>How can I solve this problem?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>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
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>
>>>---------------------------------------------------------------------
>>>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: Proxy for java.util.Set

Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Exception occurs when OJB tries set other list property by SetProxy object

org.apache.ojb.broker.metadata.MetadataException: Error setting
field:listProperty in object:ojbtest.User
 at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Pe
rsistentFieldDefaultImpl.java:165)
 at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollection(Pers
istenceBrokerImpl.java:1065)
 at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveCollections(Per
sistenceBrokerImpl.java:1137)
 at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Persistence
BrokerImpl.java:1539)
 at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByIdentity(Per
sistenceBrokerImpl.java:1642)
 at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByQuery(Persis
tenceBrokerImpl.java:1676)
 at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getObjectByQuery(
DelegatingPersistenceBroker.java:274)
 at
core.persistence.ojb.PersistenceBrokerOJBImpl.getPersistence(PersistenceBrok
erOJBImpl.java:30)

Caused by: java.lang.IllegalArgumentException
 at
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.
java:63)
 at java.lang.reflect.Field.set(Field.java:519)
 at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Pe
rsistentFieldDefaultImpl.java:147)

----- Original Message -----
> hi alexander,
>
> what kind of exception and where ?
>
> jakob
>
>
> Maksimenko Alexander wrote:
>
> >Yes.But if I specify this property
> >CollectionProxyClass=ProxySet
> >Exception will appear when I'll  materialize collection property that
> >extends java.util.List!
> >
> >
> >
> >>hi alexander,
> >>
> >>this class can be defined in ojb.properities and therefore is valid for
> >>all collection proxies.
> >>
> >>hth
> >>jakob
> >>
> >>Maksimenko Alexander wrote:
> >>
> >>
> >>
> >>>Hi !
> >>>Yes.I have exetnted CollectionProxy by SetProxy. The question is How
can
> >>>
> >>>
> >I
> >
> >
> >>>force PersistenceBroker to use this SetProxy class for materialization
> >>>
> >>>
> >one
> >
> >
> >>>of object properties. At the same time I want to be able to use
ListProxy
> >>>for other object properties.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>hi aleksander,
> >>>>
> >>>>why don't you extent CollectionProxy ?
> >>>>that's the way i implemented ListProxy.
> >>>>
> >>>>jakob
> >>>>
> >>>>
> >>>>Maksimenko Alexander wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Thanks for your answer!
> >>>>>But I can't understand the following.
> >>>>>As far as I see the method
> >>>>>
> >>>>>
> >>>>>
> >>>>>
>
>>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyCl
a
> >>>
> >>>
> >s
> >
> >
> >>>>
> >>>>
> >>>s
> >>>
> >>>
> >>>
> >>>
> >>>>>(Class collectionClass) can return either ListProxy or
CollectionProxy
> >>>>>classes. ?
> >>>>>As far as I see  if I specify CollectionProxyClass=SetProxy property
in
> >>>>>OJB.properties file then SetProxy have extend ListProxy class. I
don't
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>like
> >>>
> >>>
> >>>
> >>>
> >>>>>this approach.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
>
>>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implement
i
> >>>
> >>>
> >n
> >
> >
> >>>>
> >>>>
> >>>g
> >>>
> >>>
> >>>
> >>>
> >>>>>%201:n%20associations
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Maksimenko Alexander wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Hi!
> >>>>>>>I want to persist followed object :
> >>>>>>>
> >>>>>>>public class User{
> >>>>>>>private java.util.Set roleSet;
> >>>>>>>}
> >>>>>>>
> >>>>>>>This is the part of my repository.xml
> >>>>>>>
> >>>>>>><collection-descriptor
> >>>>>>>name="roleSet"
> >>>>>>>element-class-ref="core.Role"
> >>>>>>>indirection-table="USER_ROLE"
> >>>>>>>proxy="true"
> >>>>>>>auto-update="true"
> >>>>>>>
> >>>>>>>
> >>>>>>>While materialization, OJB attempts to set roleSet property by
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
> >>>>>org.apache.ojb.broker.metadata.MetadataException arises.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>How can I solve this problem?
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>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
> >>
> >>
> >>
> >>
> >
> >
> >
> >---------------------------------------------------------------------
> >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: Proxy for java.util.Set

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

what kind of exception and where ?

jakob


Maksimenko Alexander wrote:

>Yes.But if I specify this property
>CollectionProxyClass=ProxySet
>Exception will appear when I'll  materialize collection property that
>extends java.util.List!
>
>  
>
>>hi alexander,
>>
>>this class can be defined in ojb.properities and therefore is valid for
>>all collection proxies.
>>
>>hth
>>jakob
>>
>>Maksimenko Alexander wrote:
>>
>>    
>>
>>>Hi !
>>>Yes.I have exetnted CollectionProxy by SetProxy. The question is How can
>>>      
>>>
>I
>  
>
>>>force PersistenceBroker to use this SetProxy class for materialization
>>>      
>>>
>one
>  
>
>>>of object properties. At the same time I want to be able to use ListProxy
>>>for other object properties.
>>>
>>>
>>>
>>>      
>>>
>>>>hi aleksander,
>>>>
>>>>why don't you extent CollectionProxy ?
>>>>that's the way i implemented ListProxy.
>>>>
>>>>jakob
>>>>
>>>>
>>>>Maksimenko Alexander wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Thanks for your answer!
>>>>>But I can't understand the following.
>>>>>As far as I see the method
>>>>>
>>>>>
>>>>>          
>>>>>
>>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyCla
>>>      
>>>
>s
>  
>
>>>>        
>>>>
>>>s
>>>
>>>
>>>      
>>>
>>>>>(Class collectionClass) can return either ListProxy or CollectionProxy
>>>>>classes. ?
>>>>>As far as I see  if I specify CollectionProxyClass=SetProxy property in
>>>>>OJB.properties file then SetProxy have extend ListProxy class. I don't
>>>>>
>>>>>
>>>>>          
>>>>>
>>>like
>>>
>>>
>>>      
>>>
>>>>>this approach.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementi
>>>      
>>>
>n
>  
>
>>>>        
>>>>
>>>g
>>>
>>>
>>>      
>>>
>>>>>%201:n%20associations
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>Maksimenko Alexander wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Hi!
>>>>>>>I want to persist followed object :
>>>>>>>
>>>>>>>public class User{
>>>>>>>private java.util.Set roleSet;
>>>>>>>}
>>>>>>>
>>>>>>>This is the part of my repository.xml
>>>>>>>
>>>>>>><collection-descriptor
>>>>>>>name="roleSet"
>>>>>>>element-class-ref="core.Role"
>>>>>>>indirection-table="USER_ROLE"
>>>>>>>proxy="true"
>>>>>>>auto-update="true"
>>>>>>>
>>>>>>>
>>>>>>>While materialization, OJB attempts to set roleSet property by
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
>>>>>org.apache.ojb.broker.metadata.MetadataException arises.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>>How can I solve this problem?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>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
>>
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>


Re: Proxy for java.util.Set

Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Yes.But if I specify this property
CollectionProxyClass=ProxySet
Exception will appear when I'll  materialize collection property that
extends java.util.List!

> hi alexander,
>
> this class can be defined in ojb.properities and therefore is valid for
> all collection proxies.
>
> hth
> jakob
>
> Maksimenko Alexander wrote:
>
> >Hi !
> >Yes.I have exetnted CollectionProxy by SetProxy. The question is How can
I
> >force PersistenceBroker to use this SetProxy class for materialization
one
> >of object properties. At the same time I want to be able to use ListProxy
> >for other object properties.
> >
> >
> >
> >>hi aleksander,
> >>
> >>why don't you extent CollectionProxy ?
> >>that's the way i implemented ListProxy.
> >>
> >>jakob
> >>
> >>
> >>Maksimenko Alexander wrote:
> >>
> >>
> >>
> >>>Thanks for your answer!
> >>>But I can't understand the following.
> >>>As far as I see the method
> >>>
> >>>
>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyCla
s
> >>
> >>
> >s
> >
> >
> >>>(Class collectionClass) can return either ListProxy or CollectionProxy
> >>>classes. ?
> >>>As far as I see  if I specify CollectionProxyClass=SetProxy property in
> >>>OJB.properties file then SetProxy have extend ListProxy class. I don't
> >>>
> >>>
> >like
> >
> >
> >>>this approach.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
>
>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementi
n
> >>
> >>
> >g
> >
> >
> >>>%201:n%20associations
> >>>
> >>>
> >>>
> >>>
> >>>>Maksimenko Alexander wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi!
> >>>>>I want to persist followed object :
> >>>>>
> >>>>>public class User{
> >>>>> private java.util.Set roleSet;
> >>>>>}
> >>>>>
> >>>>>This is the part of my repository.xml
> >>>>>
> >>>>><collection-descriptor
> >>>>> name="roleSet"
> >>>>> element-class-ref="core.Role"
> >>>>> indirection-table="USER_ROLE"
> >>>>> proxy="true"
> >>>>> auto-update="true"
> >>>>>
> >>>>>
> >>>>>While materialization, OJB attempts to set roleSet property by
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
> >>>org.apache.ojb.broker.metadata.MetadataException arises.
> >>>
> >>>
> >>>
> >>>
> >>>>>How can I solve this problem?
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>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
>
>



Re: Proxy for java.util.Set

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

this class can be defined in ojb.properities and therefore is valid for 
all collection proxies.

hth
jakob

Maksimenko Alexander wrote:

>Hi !
>Yes.I have exetnted CollectionProxy by SetProxy. The question is How can I
>force PersistenceBroker to use this SetProxy class for materialization one
>of object properties. At the same time I want to be able to use ListProxy
>for other object properties.
>
>  
>
>>hi aleksander,
>>
>>why don't you extent CollectionProxy ?
>>that's the way i implemented ListProxy.
>>
>>jakob
>>
>>
>>Maksimenko Alexander wrote:
>>
>>    
>>
>>>Thanks for your answer!
>>>But I can't understand the following.
>>>As far as I see the method
>>>      
>>>
>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyClas
>>    
>>
>s
>  
>
>>>(Class collectionClass) can return either ListProxy or CollectionProxy
>>>classes. ?
>>>As far as I see  if I specify CollectionProxyClass=SetProxy property in
>>>OJB.properties file then SetProxy have extend ListProxy class. I don't
>>>      
>>>
>like
>  
>
>>>this approach.
>>>
>>>
>>>
>>>
>>>      
>>>
>>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementin
>>    
>>
>g
>  
>
>>>%201:n%20associations
>>>
>>>
>>>      
>>>
>>>>Maksimenko Alexander wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi!
>>>>>I want to persist followed object :
>>>>>
>>>>>public class User{
>>>>> private java.util.Set roleSet;
>>>>>}
>>>>>
>>>>>This is the part of my repository.xml
>>>>>
>>>>><collection-descriptor
>>>>> name="roleSet"
>>>>> element-class-ref="core.Role"
>>>>> indirection-table="USER_ROLE"
>>>>> proxy="true"
>>>>> auto-update="true"
>>>>>          
>>>>>
>>>>>While materialization, OJB attempts to set roleSet property by
>>>>>
>>>>>
>>>>>          
>>>>>
>>>org.apache.ojb.broker.accesslayer.ListProxy instance and so
>>>org.apache.ojb.broker.metadata.MetadataException arises.
>>>
>>>
>>>      
>>>
>>>>>How can I solve this problem?
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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: Proxy for java.util.Set

Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Hi !
Yes.I have exetnted CollectionProxy by SetProxy. The question is How can I
force PersistenceBroker to use this SetProxy class for materialization one
of object properties. At the same time I want to be able to use ListProxy
for other object properties.

> hi aleksander,
>
> why don't you extent CollectionProxy ?
> that's the way i implemented ListProxy.
>
> jakob
>
>
> Maksimenko Alexander wrote:
>
> >Thanks for your answer!
> >But I can't understand the following.
> >As far as I see the method
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyClas
s
> >(Class collectionClass) can return either ListProxy or CollectionProxy
> >classes. ?
> >As far as I see  if I specify CollectionProxyClass=SetProxy property in
> >OJB.properties file then SetProxy have extend ListProxy class. I don't
like
> >this approach.
> >
> >
> >
> >
>
>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementin
g
> >%201:n%20associations
> >
> >
> >>Maksimenko Alexander wrote:
> >>
> >>
> >>>Hi!
> >>>I want to persist followed object :
> >>>
> >>>public class User{
> >>>  private java.util.Set roleSet;
> >>>}
> >>>
> >>>This is the part of my repository.xml
> >>>
> >>> <collection-descriptor
> >>>  name="roleSet"
> >>>  element-class-ref="core.Role"
> >>>  indirection-table="USER_ROLE"
> >>>  proxy="true"
> >>>  auto-update="true"
> >>> >
> >>>While materialization, OJB attempts to set roleSet property by
> >>>
> >>>
> >org.apache.ojb.broker.accesslayer.ListProxy instance and so
> >org.apache.ojb.broker.metadata.MetadataException arises.
> >
> >
> >>>How can I solve this problem?
> >>>
> >>>
> >>>
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >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: Proxy for java.util.Set

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

why don't you extent CollectionProxy ?
that's the way i implemented ListProxy.

jakob


Maksimenko Alexander wrote:

>Thanks for your answer!
>But I can't understand the following.
>As far as I see the method
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyClass
>(Class collectionClass) can return either ListProxy or CollectionProxy
>classes. How can I force PersistenceBroker to use my own SetProxy class for
>lazy materialization User.roleSet property?
>As far as I see  if I specify CollectionProxyClass=SetProxy property in
>OJB.properties file then SetProxy have extend ListProxy class. I don't like
>this approach.
>
>
>  
>
>http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementing
>%201:n%20associations
>  
>
>>Maksimenko Alexander wrote:
>>    
>>
>>>Hi!
>>>I want to persist followed object :
>>>
>>>public class User{
>>>  private java.util.Set roleSet;
>>>}
>>>
>>>This is the part of my repository.xml
>>>
>>> <collection-descriptor
>>>  name="roleSet"
>>>  element-class-ref="core.Role"
>>>  indirection-table="USER_ROLE"
>>>  proxy="true"
>>>  auto-update="true"
>>> >
>>>While materialization, OJB attempts to set roleSet property by
>>>      
>>>
>org.apache.ojb.broker.accesslayer.ListProxy instance and so
>org.apache.ojb.broker.metadata.MetadataException arises.
>  
>
>>>How can I solve this problem?
>>>
>>>      
>>>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>


Re: Proxy for java.util.Set

Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Thanks for your answer!
But I can't understand the following.
As far as I see the method
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionProxyClass
(Class collectionClass) can return either ListProxy or CollectionProxy
classes. How can I force PersistenceBroker to use my own SetProxy class for
lazy materialization User.roleSet property?
As far as I see  if I specify CollectionProxyClass=SetProxy property in
OJB.properties file then SetProxy have extend ListProxy class. I don't like
this approach.


>
http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementing
%201:n%20associations
>
> Maksimenko Alexander wrote:
> > Hi!
> > I want to persist followed object :
> >
> > public class User{
> >   private java.util.Set roleSet;
> > }
> >
> > This is the part of my repository.xml
> >
> >  <collection-descriptor
> >   name="roleSet"
> >   element-class-ref="core.Role"
> >   indirection-table="USER_ROLE"
> >   proxy="true"
> >   auto-update="true"
> >  >
> > While materialization, OJB attempts to set roleSet property by
org.apache.ojb.broker.accesslayer.ListProxy instance and so
org.apache.ojb.broker.metadata.MetadataException arises.
> > How can I solve this problem?
> >





Re: Proxy for java.util.Set

Posted by Thomas Mahler <th...@web.de>.
http://db.apache.org/ojb/tutorial3.html#types%20allowed%20for%20implementing%201:n%20associations

Maksimenko Alexander wrote:
> Hi! 
> I want to persist followed object :
> 
> public class User{
>   private java.util.Set roleSet;    
> }
> 
> This is the part of my repository.xml 
> 
>  <collection-descriptor
>   name="roleSet"
>   element-class-ref="core.Role"
>   indirection-table="USER_ROLE"
>   proxy="true"
>   auto-update="true"
>  >
> While materialization, OJB attempts to set roleSet property by org.apache.ojb.broker.accesslayer.ListProxy instance and so org.apache.ojb.broker.metadata.MetadataException arises. 
> How can I solve this problem?
> 
>