-->
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: Basic Mapping Question
PostPosted: Wed Oct 20, 2004 8:40 pm 
Beginner
Beginner

Joined: Fri Jan 16, 2004 4:58 pm
Posts: 37
Hibernate version:2.1.6

I am have a tough time trying to figure out when to use joined-subclass, component, many-to-one, etc.

I have a table that is called issues. In a form I have several drop down boxes with choices for things like PC Model (Gateway, Dell, etc) Monitor Model (VX770, EV700, etc), Operating System, etc, etc. All these are retrieved from respective tables in my database and all these tables basically have 2 fields (id and Model) respectivly. My issue table will just hold the id of these other tables as foreign keys.

My question is what should I use to map these so that when I write an issue to the database, the id is put in the issue table, but when I retrieve these values for display, I have the actual text (model field) of that id that was stored?

I looked into using a Set or Map or List but those hold collections and these are single static items per issue. A one-to-one mapping really. So should I create POJO's for each of these tables with the 2 properties? That seems like overkill for what I want to do unless that is the only way? I have been reading HIA and I understand how to use all of the different mapping types, but figuring out when is what is getting me.

Thanks for any help

_________________
Gregg Bolinger
Javaranch Sheriff
Weblog


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 12:36 pm 
Beginner
Beginner

Joined: Fri Aug 13, 2004 3:07 pm
Posts: 44
Well actually, I think having hbm mapped classes for these objects would be a good thing to do. Agreed it is a bit of work upfront but once done, you will have the same classes shared across multiple users of your system in that you could specify these as read only classes in the cache so as to avoid the DB hits for just lookups etc.

Just a suggestion.

_________________
Thanks
Sameet


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 4:07 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
Work on your domain model first - identify the main enties in your system and then identify the relationships between them. Once you have this firm in your mind (or better still a class diagram), then it will be obvious which of the mapping types you need to map the relationships between your objects.

Kevin


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.