-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Auto-generation of Foreign key constraints
PostPosted: Sun Sep 14, 2008 8:01 am 
Newbie

Joined: Sun Sep 14, 2008 7:50 am
Posts: 1
Hi everyone,

I have a simple but delicate problem.

I have an existing database schema created in MS SQL 2000, inherited

from a legacy application (that I'm migrating to Java).

In my JPA entities I used to add some @ManyToOne properties

in order to load some join data (for easy use in JSF data tables).

But Hibernate (certainly not jTDS) always auto generates foreign key

constraints for each such associations when it does not exist physically!!

[size=16]How can I prevent Hibernate from modifying my database schema??[/size]

Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2008 9:30 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

do you mean that Hibernate is modifying your schema at startup? If so check whether you have the property hibernate.hbm2ddl.auto defined in your configuration. If so you should remove it, then your schema won't be modified.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 25, 2008 12:24 pm 
Newbie

Joined: Tue Nov 25, 2008 12:20 pm
Posts: 1
Hi,

What if I want my schema created automatically but I don't need the foreign keys for relations.
Does anybody know how this can be done except specifying in mapping foreign-key="null" ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2008 6:34 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I don't think you can, but try the Tools forum.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.