Hibernate mapping problem

Discussion in 'Java' started by garhone, Aug 24, 2006.

  1. garhone

    garhone Guest

    Hi,

    I've having trouble mapping a class with a composite key, part or all
    of which are foreign keys, with a many-to-one relationship

    class Mod {
    private Integer codNum;
    private Integer podNum;
    }

    class Cod {
    private Integer codNum;
    }

    class Pod {
    private Integer podNum;
    }

    The primary key of Mod is composed of codNum and podNum, which are
    foreign keys to Pod and Cod, where Mod <- many-to-one -> Cod, and Mod
    <- many-to-one -> Pod

    If this is Mod.hbm.xml
    <composite-id>
    <key-property name="codNum" type="integer" column="cod_num" />
    <key-property name="podNum" type="integer" column="pod_num" />
    </composite-id>

    How can I express the many-to-one relationship(s) and the class each
    property belongs to?

    Thanks
    garhone, Aug 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    1,718
    Ilias Lazaridis
    Dec 27, 2004
  2. Replies:
    7
    Views:
    4,618
    lars.egarots
    Jul 22, 2008
  3. ducnbyu
    Replies:
    2
    Views:
    6,147
    ducnbyu
    Sep 8, 2006
  4. Replies:
    0
    Views:
    375
  5. Replies:
    1
    Views:
    673
    David Portabella
    Sep 9, 2007
Loading...

Share This Page