Results 1 to 4 of 4

Thread: Hibernate and

  1. #1
    Join Date
    Jul 2005
    Posts
    20

    Default 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. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    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...
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3
    Join Date
    Jul 2005
    Location
    Idaho
    Posts
    231

    Default

    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

  4. #4
    Join Date
    Jul 2005
    Posts
    20

    Default

    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!

Similar Threads

  1. Replies: 5
    Last Post: Dec 27th, 2005, 07:00 AM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  4. Replies: 9
    Last Post: Sep 25th, 2004, 12:35 PM
  5. Replies: 7
    Last Post: Aug 21st, 2004, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •