the question then is can we improve the error reporting and give the user enough info 
to have the problem become evident?

        -----Original Message----- 
        From: Brian McCallister [mailto:[EMAIL PROTECTED]] 
        Sent: Mon 2/3/2003 4:57 AM 
        To: OJB Users List 
        Cc: 
        Subject: Re: Collection help, please...
        
        

        Thank you!
        
        I figured it was something silly like that which I wasn't seeing because
        I had looked at it for too long. (C&P "reuse" strikes again ;-)
        
        -Brian
        
        On Sun, 2003-02-02 at 23:22, Ron Gallagher wrote:
        > Brian --
        >
        > Your class descriptor for org.skife.registry.domain.User includes two fields 
that are marked as primary keys, userId and handle.  In that situation, you need to 
specify two inverse-foreignkey entries for the giftsRequested collection descriptor, 
one for each field in the primary key.
        >
        > I'm guessing that marking the field "handle" as a primary key is a mistake 
since there's no "handle" field on the gifts table.
        >
        > HTH
        >
        > Ron Gallagher
        > Atlanta, GA
        > [EMAIL PROTECTED]
        >
        > >
        > > From: Brian McCallister <[EMAIL PROTECTED]>
        > > Date: 2003/02/02 Sun PM 07:56:22 EST
        > > To: OJB Users List <[EMAIL PROTECTED]>
        > > Subject: Collection help, please...
        > >
        > > I feel silly for not being able to figure this out, but I have not been
        > > able to. I am sure it is some small configuration problem I have missed,
        > > but looking over the docs, and my code, I cannot find it. Of note - OJB
        > > .9.8, PostgreSQL 7.3, the standard pgsql jdbc3.0 driver.
        > >
        > > When I attempt to instantiate a class (source follows) which has a
        > > collection of other persistent objects in it, I get a nasty series of
        > > JDBC exceptions.
        > >
        > > I only have two classes for this setup, a User class and a Gift class -
        > > the User contains a Vector of Gifts.
        > >
        > > If there is a User in the database:
        > >
        > > registry=> select * from users ;
        > >  userid | handle | password | firstname |  lastname
        > > --------+--------+----------+-----------+-------------
        > >       1 | wheee  | tester   | Brian     | McCallister
        > > (1 row)
        > >
        > > and a gift for that user:
        > >
        > > registry=> select * from gifts ;
        > >  giftid |     name     | foruserid
        > > --------+--------------+-----------
        > >       1 | Wireless Hub |         1
        > > (1 row)
        > >
        > > before the tests run and I attempt to load said user I get the
        > > exception. If i delete the gift frm the database I have no problem, if I
        > > add a gift in the test and then load the user again, no problem, but if
        > > the gift exists before I start running the test, boom it dies.
        > >
        > > The test is simply loading the user via a query for the handle via the
        > > PB API.
        > >
        > > Any help would be much appreciated
        > >
        > > <class-descriptor
        > >     class="org.skife.registry.domain.User"
        > >     table="USERS"
        > >     >
        > >     <field-descriptor id="1"
        > >         name="userId"
        > >         column="userid"
        > >         jdbc-type="INTEGER"
        > >         primarykey="true"
        > >         autoincrement="true"
        > >         indexed="true"
        > >         />
        > >     <field-descriptor id="2"
        > >         name="firstName"
        > >         column="firstname"
        > >         jdbc-type="VARCHAR"
        > >         nullable="true"
        > >         />
        > >     <field-descriptor
        > >         id="3"
        > >         name="lastName"
        > >         column="lastname"
        > >         jdbc-type="VARCHAR"
        > >         nullable="true"
        > >         />
        > >     <field-descriptor id="4"
        > >         name="password"
        > >         column="PASSWORD"
        > >         jdbc-type="VARCHAR"
        > >         />
        > >     <field-descriptor id="5"
        > >         name="handle"
        > >         column="HANDLE"
        > >         jdbc-type="VARCHAR"
        > >         primarykey="true"
        > >         indexed="true"
        > >         />
        > >     <collection-descriptor
        > >         name="giftsRequested"
        > >         element-class-ref="org.skife.registry.domain.Gift"
        > >         auto-update="true"
        > >         auto-delete="true"
        > >         >
        > >         <inverse-foreignkey field-id-ref="3"/>
        > >     </collection-descriptor>
        > > </class-descriptor>
        > >
        > > <class-descriptor
        > >     class="org.skife.registry.domain.Gift"
        > >     table="GIFTS">
        > >     <field-descriptor id="1"
        > >         name="id"
        > >         column="giftid"
        > >         jdbc-type="INTEGER"
        > >         primarykey="true"
        > >         autoincrement="true"
        > >         indexed="true"
        > >         />
        > >     <field-descriptor
        > >         id="2"
        > >         name="name"
        > >         column="name"
        > >         jdbc-type="VARCHAR"
        > >         nullable="true"
        > >         />
        > >     <field-descriptor
        > >         id="3"
        > >         name="userId"
        > >         column="foruserid"
        > >         jdbc-type="INTEGER"
        > >         />
        > >     <reference-descriptor
        > >         name="user"
        > >         class-ref="org.skife.registry.domain.User"
        > >         auto-update="false"
        > >         auto-delete="false"
        > >         >
        > >         <foreignkey field-id-ref="3"/>
        > >     </reference-descriptor>
        > >
        > > </class-descriptor>
        > >
        > <snip>
        >
        >
        > ---------------------------------------------------------------------
        > To unsubscribe, e-mail: [EMAIL PROTECTED]
        > For additional commands, e-mail: [EMAIL PROTECTED]
        --
        Brian McCallister < [EMAIL PROTECTED] >
        Systems Administrator and Software Engineer
        Fort Hill Company    --    www.forthillcompany.com
        
        
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]
        
        

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


Reply via email to