-->
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.  [ 3 posts ] 
Author Message
 Post subject: Don't map foreign key to class using hibernate-tools
PostPosted: Thu Oct 20, 2011 12:29 pm 
Newbie

Joined: Thu Oct 20, 2011 12:20 pm
Posts: 2
Hi,
I have a question about foreign-key column mapping using hibernate-tools:
Can I use configure the tool to map foreign-key columns to simple get/set properties instead of many-to-one Class?
For example,
Table A {
id, primary-key
companyId, foreign-key}

Table Company {
companyId, primary Key,
}

In table A mapping, the tool generate java:
Class A {
Long id,
Company company;
...
}

But I want
Class A {
Long id,
Long companyId,//just like other columns
..
}

Can I do this using the hibernate-tools?

G


Top
 Profile  
 
 Post subject: Re: Don't map foreign key to class using hibernate-tools
PostPosted: Sun Nov 20, 2011 3:50 pm 
Newbie

Joined: Fri Nov 18, 2011 12:45 pm
Posts: 2
Well, you should try. If I'm not mistaken it is possible

_________________
http://www.intellectsoft.net/ Intellectsoft US. They are really professional team.


Top
 Profile  
 
 Post subject: Re: Don't map foreign key to class using hibernate-tools
PostPosted: Mon Nov 21, 2011 7:38 pm 
Newbie

Joined: Mon Nov 21, 2011 6:21 pm
Posts: 3
Try excluding the many-to-one:

<foreign-key name="foreign-key">
<many-to-one exclude="true" />
</foreign-key>

If you also want to exclude in the other direction, exclude the Set:

<foreign-key name="foreign-key">
<many-to-one exclude="true" />
<set exclude="true" />
</foreign-key>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.