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 Christian Pesch <ch...@coremedia.com> on 2003/08/07 17:38:20 UTC

Collection problem

Hi all,

could somebody explain to me, which collection types
are supported under which conditions? I experience the
problem, that after some changes at different parts
of my project

private Set artists = new HashSet();

for me out of a sudden does not work anymore - I don't
have a clue what makes it fail. But if I replace it with

private List artists = new Vector();

it does work without errors. The error message is:

[org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl] 
ERROR: while set field:
object class[ GroupImpl
target field: artists
target field type: interface java.util.Set
object value class: 
org.apache.ojb.broker.util.collections.RemovalAwareCollection
object value: [ArtistImpl@2af081]
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(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown 
Source)
        at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
        at 
org.apache.ojb.broker.accesslayer.ChainingIterator.next(Unknown Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
        at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source)
rethrown as org.apache.ojb.broker.metadata.MetadataException: Error 
setting field:artists in GroupImpl
        at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown 
Source)
        at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
        at 
org.apache.ojb.broker.accesslayer.ChainingIterator.next(Unknown Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
        at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source)

The documentation lists java.util.Collection in the
"types allowed for implementing 1:n associations"
section. Isn't a HashSet a Collection?
Any help is appreciated.

-- 
Christian


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