a double reference persistence problem?

Discussion in 'Java' started by Elhanan, Oct 31, 2006.

  1. Elhanan

    Elhanan Guest

    hi..

    i have the following model,

    a Breif, has several AssuredPersons, and several Polices.

    each Polices has a Plan.

    BUT

    an AssuredPerson can have several Plans, from different Polices.

    so i was thinking how can i can persists this, how can i be fexible and
    allow a person to add a plan to a policy, or allow a policy to add a
    plan and relate to a person, and how would i persists this with
    hibernate.

    so i came up with this:

    i would have a PersonPlanLink class which holds a refence to one
    AssuredPerson, one Refernce to Policy Class, and would be stored as
    collection inside the Brief class. (a bi-di association in hibernate
    no?)

    so, the AssuredPerson class will have to have a refernce to it's Brief
    class, and the Policy Class willl have a reference to it's Breif class
    as well, each will recieve a message to a plan, but internally they
    will delegate this to the brief class, which really is going to manage
    the collection, and have package level setters and getters for
    hibernate to persist (is this ok with hibernate?)

    also when each one willl be requested to get it's own childen (getPlans
    for AssuredPerson) they will query the Brief inorder to get it.

    what do you think?
    Elhanan, Oct 31, 2006
    #1
    1. Advertising

  2. Elhanan

    Tom Forsmo Guest

    Elhanan wrote:
    > hi..
    >
    > i have the following model,
    >
    > a Breif, has several AssuredPersons, and several Polices.
    >
    > each Polices has a Plan.
    >
    > BUT
    >
    > an AssuredPerson can have several Plans, from different Polices.
    >
    > so i was thinking how can i can persists this, how can i be fexible and
    > allow a person to add a plan to a policy, or allow a policy to add a
    > plan and relate to a person, and how would i persists this with
    > hibernate.
    >
    > what do you think?



    You should perhaps look at serialisation, it deals with such reference
    problems. You might be able to use that as a starting point for
    persisting your data.

    tom
    Tom Forsmo, Nov 3, 2006
    #2
    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. jahyen
    Replies:
    0
    Views:
    2,494
    jahyen
    Jan 6, 2005
  2. javaguy44
    Replies:
    10
    Views:
    974
    Michael Berg
    May 18, 2004
  3. Jacek Dziedzic
    Replies:
    5
    Views:
    384
    Old Wolf
    Apr 8, 2004
  4. Sydex
    Replies:
    12
    Views:
    6,484
    Victor Bazarov
    Feb 17, 2005
  5. Kenneth P. Turvey

    Java Persistence API and persistence.xml

    Kenneth P. Turvey, Mar 15, 2008, in forum: Java
    Replies:
    2
    Views:
    17,307
    Kenneth P. Turvey
    Mar 16, 2008
Loading...

Share This Page