-->
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.  [ 6 posts ] 
Author Message
 Post subject: setting up mapping with xdoclet, by using a mapping table
PostPosted: Fri Sep 03, 2004 11:03 am 
Beginner
Beginner

Joined: Sun Aug 01, 2004 5:16 am
Posts: 22
Location: BERLIN
this is what i got at the database:

table1(person_city_mapping)
column1(person_id)
column2(person_city_id)

table2(cities)
column1(city_id)
column2(city_names)


table3(persons)
column1(persons_id)
column2(persons_names)



in java i want to have following classe:

class person{//all other properties are set (e.g. id and so on)

public City getCity();


}


how it is possible to realize this trough xdoclet?

if any idea thanx....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 03, 2004 5:42 pm 
Beginner
Beginner

Joined: Tue Dec 09, 2003 3:27 pm
Posts: 21
xdoclet comes with examples, it's not that difficult to figure out.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 9:20 am 
Beginner
Beginner

Joined: Sun Aug 01, 2004 5:16 am
Posts: 22
Location: BERLIN
the difficulty is not set on how to use xdoclet.....
the problem is to get an object mapped trough a third table...
your answer did'nt help me....;-)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 06, 2004 11:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You can't
Your remlational model describe a n-n association and you want to map it as a 1-n in your domain model. This is not possible.
But you can write a getter/Setter delegating to an hidden n-n relationship

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 07, 2004 11:53 am 
Beginner
Beginner

Joined: Tue Dec 09, 2003 3:27 pm
Posts: 21
yup sorry, I misinterpreted what you had said. I agree with emmanuel, your datamodel doesn't match your object model. But if you really want city to a many-to-one off of person, maybe you should drop the person_city_mapping table and add a city_id column to the persons table.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 6:08 am 
Beginner
Beginner

Joined: Sun Aug 01, 2004 5:16 am
Posts: 22
Location: BERLIN
if i drop that table , i would need a new job.....;-)
i prefer the getter method, thanx anyway (really, thx)


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