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

  • Hibernate and

    Is it possible to define a <many-to-one> mapping in a <hibernate-mapping> if you don't have any foreign key constraints defined? I currently do not and I can't find an example of a <many-to-one> with no foreign key constraints? Anyone have an example they can point me to?

    --Joe

  • #2
    You do need a foreign key, but you don't need foreign key constraints. Not all databases have foreign key constraints. Not sure if this answers what you're driving at, though...

    Comment


    • #3
      Whackity,

      I'm not sure what your database looks like, but I don't have any FK contraints defined (for portability reasons) and have <many-to-one> relationships mapped and working just fine.

      The Hibernate documentation here: http://www.hibernate.org/hib_docs/v3...tion-manytoone
      should be able to help you out.

      Also, if you wish to post the <hibernate-mapping> file (or relevant portions)...

      Steve

      Comment


      • #4
        Oh ok. I get it. My db supports foreign keys, but not constraints. I was getting those two concepts mixed up. Thanks! So all I need are the "REFERENCES table(id)" in my CREATE TABLE statements.

        Yes, it is working. Thanks all!

        Comment

        Working...
        X