Sorry, but this doesn't work, either.
The error message appears none the less.
Maybe the stack trace is of help for you!

Thank you for your help
Christoph

[BOOT] INFO: OJB.properties: file:/home/chris/java/projects/ojb/bin/OJB.properties
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Already created 
persistence broker instances: 0
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] INFO: Use sequence 
manager class: class org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Already created 
persistence broker instances: 1
[org.apache.ojb.broker.accesslayer.AbstractPoolableConnectionFactory] INFO: # Create 
connection pool for JdbcDescriptorKey -452004565 #
[org.apache.ojb.broker.accesslayer.AbstractConnectionFactory] INFO: # Already created 
connections: 1 returning : org.postgresql.jdbc2.Connection@195d80
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Already created 
persistence broker instances: 2
[org.apache.ojb.broker.accesslayer.AbstractConnectionFactory] INFO: # Already created 
connections: 2 returning : org.postgresql.jdbc2.Connection@4e5b1c
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Already created 
persistence broker instances: 3
org.apache.ojb.broker.metadata.MetadataException: Error creating PersistentField: 
net.uhrhan.musicdb.data.Song, Artist
        at 
org.apache.ojb.broker.metadata.PersistentFieldFactory.createPersistentField(Unknown 
Source)
        at 
org.apache.ojb.broker.metadata.AttributeDescriptorBase.getPersistentField(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReference(Unknown Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReferences(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.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source)
        at net.uhrhan.musicdb.Application.run(Application.java:82)
        at net.uhrhan.musicdb.Application.main(Application.java:57)
[org.apache.ojb.broker.accesslayer.RsIterator] ERROR: Error creating PersistentField: 
net.uhrhan.musicdb.data.Song, Artist
org.apache.ojb.broker.metadata.MetadataException: Error creating PersistentField: 
net.uhrhan.musicdb.data.Song, Artist
        at 
org.apache.ojb.broker.metadata.PersistentFieldFactory.createPersistentField(Unknown 
Source)
        at 
org.apache.ojb.broker.metadata.AttributeDescriptorBase.getPersistentField(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReference(Unknown Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReferences(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.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source)
        at net.uhrhan.musicdb.Application.run(Application.java:82)
        at net.uhrhan.musicdb.Application.main(Application.java:57)
Exception in thread "main" java.util.NoSuchElementException
        at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
        at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source)
        at net.uhrhan.musicdb.Application.run(Application.java:82)
        at net.uhrhan.musicdb.Application.main(Application.java:57)


On Tuesday 24 September 2002 21:20, Dave Derry wrote:
> If your setup looks exactly like the tutorial, you're looking at the wrong
> part of the tutorial.  ;-}
>
> Look at the 'mapping 1:n associations'> You need a collection-descriptor in
> the class descriptor for artist, since an artist will have a collection of
> songs.
>
> Hope this helps,
> Dave Derry
>
> ----- Original Message -----
> From: "Christoph Uhrhan" <[EMAIL PROTECTED]>
>
>
> Hello,
> I have a problem with foreign key references. I've been searching the list
> but
> didn't find an answer, so I'm rather desperate.
> I have OJB running on a PostgreSQL-Database and a fairly simple example
> that just won't work.
>
> These are the tables:
>
> create table artist
> (
>   artistid serial primary key,
> name varchar(300),
> since int,
> until int
> );
>
> create table song
> (
>   songid serial primary key,
> title varchar(500) not null,
> artistid int references artist,
> mp3genreid int references mp3genre,
> year int
> );
>
> This is the mapping:
>
> <class-descriptor
> class="net.uhrhan.musicdb.data.Artist"
> table="artist"
>
> <field-descriptor id="1"
> name="id"
> column="artistid"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
> <field-descriptor id="2"
> name="name"
> column="name"
> jdbc-type="VARCHAR"
> />
> <field-descriptor id="3"
> name="since"
> column="since"
> jdbc-type="INTEGER"
> />
>
> <field-descriptor id="4"
> name="until"
> column="until"
> jdbc-type="INTEGER"
> />
> </class-descriptor>
>
>
> <class-descriptor
> class="net.uhrhan.musicdb.data.Song"
> table="song"
>
> <field-descriptor id="1"
> name="id"
> column="songid"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="false"
> />
> <field-descriptor id="2"
> name="title"
> column="title"
> jdbc-type="VARCHAR"
> />
> <field-descriptor id="3"
> name="artistid"
> column="artistid"
> jdbc-type="INTEGER"
> />
> <reference-descriptor
> name="Artist"
> class-ref="net.uhrhan.musicdb.data.Artist"
>
> <foreignkey field-id-ref="3"/>
> </reference-descriptor>
> </class-descriptor>
>
> And querying via the ODMG-API and the PersistenceBroker-API I get the
> following error-Message:
>
> org.apache.ojb.broker.metadata.MetadataException: Error creating
> PersistentField: net.uhrhan.musicdb.data.Song, Artist
>
> What am I doing wrong? The setup looks exactly like that presented in the
> 'Advanced O/R-Mapping'-Tutorial.
>
> Thanks in advance for your help (and your patience)
> Cheers
> Christoph


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to