-->
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.  [ 5 posts ] 
Author Message
 Post subject: 1 mapping, 1 class , multiple equal tables - Is it possible?
PostPosted: Mon Jan 23, 2006 9:38 am 
Newbie

Joined: Mon Jan 23, 2006 9:22 am
Posts: 2
Hi, im using Hibernate version: 3
I have a question regarding mapping.

For example say that i have 4 tables called A,B,C,D
All theese tables are exactly the same except for the PK name wich is A_id, B_id etc.
This setup is needed cause the tables get so big that i get performance problems.

What i want to do is to make 1 mapping file and 1 class, to be able to access all theese tables.
Is it possible to change id name/table name under runtime, if so does it have any negative effect to do so?

Or is it possible to make 4 mapping files to 1 class to make it work instead?

In my real world problem i have current 20x3 equal tables and i dont want to generate 1 mapping and 1 class for each table and they all does the same thing in my code. It will be harder to maintain as it grows.

I aprreciate all thoughts/ideas and help regarding this issue.


Top
 Profile  
 
 Post subject: alternative
PostPosted: Tue Jan 24, 2006 6:37 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I do not think that H could elegantly help in your situation.
You may want to use iBatis to work with those tables, and you may combine iBatis and H
http://sandbox.sourcelabs.com/kosta/hb- ... batis.html

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 5:13 am 
Newbie

Joined: Mon Jan 23, 2006 9:22 am
Posts: 2
Thanks for the reply, im gonna look into iBatis.

But i've seem to have found another solution that is acceptable for my problem.
By using entity-name for each mapping will allow me to use a single class for the tables, but i still have to have 1 mapping for each table.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 5:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes and as far as i know that is the same case for ibatis (just to keep the record straight ;)

And yes, entity-name is the right way to do this if you want to use the same class for multiple tables in the same sessionfactory.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: mapping
PostPosted: Wed Jan 25, 2006 11:42 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
majjo wrote:
By using entity-name for each mapping will allow me to use a single class for the tables, but i still have to have 1 mapping for each table.


Yes, one mapping per table, shared parts can be defined as XML entities and reused.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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