I have just started with OJB and got stuck rather quickly :S

I have two tables...

User
TABLE User
    ID            int           not null,
    firstName     varchar(50)   not null,
    lastName      varchar(50)   not null,
    userName      varchar(50)   not null,
    password      varchar(50)   not null,
    emailAddress  varchar(50)   not null,
    phone         varchar(14),
    roleID        int           not null,
    disabled      char(1)       not null,

    primary key(ID)

Role
TABLE Role
  (
    ID           int           not null,
    name         varchar(50)   not null,
    description  text,

    primary key(ID)

if I map these tables separate:
<class-descriptor class="com.datatrio.OfficeManager.User" table="USER">
        <field-descriptor name="ID" primarykey="true" autoincrement="true"
column="ID" jdbc-type="INTEGER"/>
        <field-descriptor name="firstName" nullable="false" column="FIRSTNAME"
jdbc-type="VARCHAR"/>
        <field-descriptor name="lastName" nullable="false" column="LASTNAME"
jdbc-type="VARCHAR"/>
        <field-descriptor name="userName" nullable="false" column="USERNAME"
jdbc-type="VARCHAR"/>
        <field-descriptor name="password" nullable="false" column="PASSWORD"
jdbc-type="VARCHAR"/>
        <field-descriptor name="emailAddress" nullable="false"
column="EMAILADDRESS" jdbc-type="VARCHAR"/>
        <field-descriptor name="phone" column="PHONE" jdbc-type="VARCHAR"/>
        <field-descriptor name="roleID" nullable="false" column="ROLEID"
jdbc-type="INTEGER"/>
        <field-descriptor name="disabled" nullable="false" column="DISABLED"
jdbc-type="CHAR"/>
</class-descriptor>
<class-descriptor class="com.datatrio.OfficeManager.Role" table="ROLE">
        <field-descriptor name="ID" primarykey="true" autoincrement="true"
column="ID" jdbc-type="INTEGER"/>
        <field-descriptor name="name" nullable="false" column="NAME"
jdbc-type="VARCHAR"/>
        <field-descriptor name="description" column="DESCRIPTION"
jdbc-type="VARCHAR"/>
</class-descriptor>

My simple implementor bean can add and remove roles perfectly. I need to
join roleID on role id field. I added:
        <reference-descriptor name="Role"
class-ref="com.datatrio.OfficeManager.Role" auto-update="false"
auto-delete="false">
                <inverse-foreignkey field-ref="roleID"/>
        </reference-descriptor>

To the user class-descriptor, and it dies. (initializerException) If I add
another reference from role to user, I can *add* roles, but they never get
returned. I dont need any user information if I load a role... I only need
the role information when I load a user... Is there more docs on
repository.xml? or do I need to change my beans?

I used Druid to generate my class files, and I am using the JDO
implementation of OJB.


JD Daniels


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

Reply via email to