-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to Persist an object in different tables based on field
PostPosted: Wed Dec 17, 2008 2:52 am 
Newbie

Joined: Wed Dec 17, 2008 2:37 am
Posts: 4
I have an object Property and it has fields like

private City city;

private TransactionType transaction_type;

For some cities and transaction_types I want to store them in different tables (to optimize queries - not sure if its the correct approach).

1)How can it be done?
2)I am not sure if storing in different tables after checking the values of fields is the correct approach to reduce time taken by queries.. Any suggestions/comments ?

P.S. : I am completely new to hibernate..so excuse me if this question is too basic and any references to resources will be greatly appreciated..


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2008 10:10 pm 
Newbie

Joined: Wed Dec 17, 2008 6:35 pm
Posts: 11
I think I probably need a little more details to make a suggestion, but I find it a little strange that you have an object called Property which has a City and a Transaction type. This doesn't seem very OO.

I'm not really sure of your context, but hibernate has several ways of doing inheritance (discriminators, etc). Also things like cities an typical database model may be to have a single city table and many cross reference tables that point your main object (which implies a many-to-many relationship).

I think a little more context of what you're trying to do might be helpful.


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