-->
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.  [ 7 posts ] 
Author Message
 Post subject: Mapping another table column in an entity property
PostPosted: Sun Feb 08, 2004 5:14 pm 
Beginner
Beginner

Joined: Sun Feb 08, 2004 4:09 pm
Posts: 46
Hi ppl,


I have tons of tables used to list types and status types... So if a have for example an Employee that could be a chief or a coordinator, in the database I have an id_situation foreign key that would tell me that, althought I don't want to map a specific Situation entity for the Employee having something like employee.situation.description, I would like that employee.situation would be of type String having situation.description as it's value... is there anyway to map this or this is done forward in classes implementation?

Cya!
Thiago Souza


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 5:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If I get you right, you want a list containing strings? Just map it as a set using the <element> subtag. Look at the "Mapping Collections" Chapter of the Manual.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 5:53 pm 
Beginner
Beginner

Joined: Sun Feb 08, 2004 4:09 pm
Posts: 46
Hi!


No, it's not a list... it's just a simples string atribute, but the value would come from another table, like I said, i have Employee that has a Situation, in database, this just an id_situation foreing key from situation table, the situation table only have the description field (that tells the situation's description like "chief" ou "coordinator"), but I don't want to map this so I get employee.situation.description, want that that when I select an employee, that somewhere, employee is joined with situation and the employee.situation field would filled with his related situtation.description... got it? =)

Cya!
Thiago Souza


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 6:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No this is not supported yet, one class and its properties have to be mapped to one table. Might be introduced in 2.2 with the <join> element.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 6:09 pm 
Beginner
Beginner

Joined: Sun Feb 08, 2004 4:09 pm
Posts: 46
ah ok, thanks!


Well, As I see you are there right now helping me out... please answear just a couple of questions =)

Is there any way to define an abstract class?
What if i don't set a table for a class?

Cya!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 6:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just take a look at http://www.hibernate.org/hib_docs/reference/html/inheritance.html - you can handle an abstract class just like an interface.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 6:25 pm 
Beginner
Beginner

Joined: Sun Feb 08, 2004 4:09 pm
Posts: 46
Thanks!


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