-->
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: Map to only certain fields in a table
PostPosted: Wed Dec 10, 2003 3:51 pm 
Newbie

Joined: Fri Dec 05, 2003 11:07 am
Posts: 14
Is it possible to map to only certain fields in a Database table.
For example:

I have a table with 10 fields but really only ever need 2. So I create a class with 2 attributes and map to those 2 specific fields in the DB in my xml file. Is there a way this can be done, or do I have to map to every field in the DB.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 4:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes - of course you can do this! Have you even tried to do it ? ;)
(the only "limitation" i can see is only how your primary key, constraints and indexes are at the db - you of course need to do something with columns that are required at the db layer....Hibernate don't care, but your db does ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 4:47 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
Make sure that unmapped fields DO NOT have not null constrains on them and you should be fine.

_________________
Mauricio Hern


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.