Announcement Announcement Module
Collapse
No announcement yet.
Hibernate one-to-one mapping. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate one-to-one mapping.

    Hi all,
    While this strictly isint a spring related question, from the web serach I have done, there seem to be a number of people saying there might be a problem in springs handling of hibernate one-to-one, so I am looking here for an answer first.

    I have two tables. originally there was a one-to-many relationship, but we have decided to reduce this to a one-to-one relationship.

    (Now I would like to do this without changing the tables, as I dont really like null columns.)

    TableA
    ID
    name

    TableB
    ID
    tableA_ID
    name

    Now by default the one-to-one maps ID to ID, but I would like to map map TableA.ID to TableB.tableA_ID.

    all of the querying is done from TableA's point of view as it is the parent.

    How would I accomplish this, currently, having played with the foreign-ket attribute and formula I still get the previous result of ID to ID mapping.

    Thanks.
    G

  • #2
    I don't know what discussions you've read but I don't see why there would be a problem. The Hibernate mapping is nothing to do with Spring, so as long as what your proposing works it will work with Spring.
    Last edited by karldmoore; Aug 27th, 2007, 03:19 PM.

    Comment


    • #3
      Yeah well, it did seem a bit fishy, seeing as how if I am honest I havent really had any issues with spring. Just with hibernate, and those were of my own making.

      I have tried pretty much every combination of foreign-key I can think of and I still get the same defualt behaviour.
      The habernate forums have suggest a solution (apprently from the docs) so will have a look.

      Thanks

      Comment

      Working...
      X