-->
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: @ForeignKey on fields in @Embeddable classes
PostPosted: Sun Jun 01, 2008 8:32 am 
Newbie

Joined: Sun Apr 06, 2008 6:38 am
Posts: 4
I wanted to give meaningful names to my foreign keys & constraints.

Quite easy, I thought... Just add @ForeignKey on all the @ManyToOne properties that generate the foreign keys, and that's it...

But - This becomes a problem for properties inside reusable @Embeddable classes (e.g. Address)...

When several tables embed the Address component, the @ForeignKey attempts to create the same constraint name in all these tables.

This causes MYSQL to become very angry, because it requires uniqueness among all constraint names in a database.

How can I force a meaningful constraint name on fields of embeddable objects? I couldn't find a way to override the @ForeignKey definition at the 'instantiation' (@Embedded) location...

Any help would be appreciated.

Thanks,
Michael


Top
 Profile  
 
 Post subject: @ForeignKey on fields in @Embeddable classes
PostPosted: Fri Jan 02, 2009 9:52 am 
Newbie

Joined: Fri Jan 02, 2009 9:43 am
Posts: 2
I second the motion.

Additionally, there's nothing in the @ForeignKey annotation to enable selection of particular field in @Embeddable class, and there's nothing in @AssociationOverrides to enable it, either.

These would seem to be serious shortcomings, either on my part for not finding this in the Docs or on Hibernate's part for not addressing them in a consistent way.

Can someone from Hibernate please comment?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2009 9:32 am 
Hibernate Team
Hibernate Team

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

you guys are posting on the wrong forum! This forum is only for Search, Validator, Shards.

Post you questions to the main Hibernate User Forum.

--Hardy


Top
 Profile  
 
 Post subject: @ForeignKey on fields in @Embeddable classes
PostPosted: Mon Jan 05, 2009 9:51 am 
Newbie

Joined: Fri Jan 02, 2009 9:43 am
Posts: 2
Acknowledged. Thank you.


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.