-->
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: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 6:33 am 
Beginner
Beginner

Joined: Fri Nov 05, 2010 7:25 am
Posts: 21
I am not meaning one pojo with its fields in different tables.

I mean one pojo with multiple tables which own the same structure.

Since I am fraid the table may change too large,so I wonder if there is any way?

I have read the docs of hibernate shard,however I found it is rather complex...


Top
 Profile  
 
 Post subject: Re: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 6:50 am 
Beginner
Beginner

Joined: Fri Nov 26, 2010 8:25 am
Posts: 21
Hi,
It is possible to have tables with identical structure, but they would have to have different names. However splitting records for the same POJO entity across two different tables is not a good idea! Why do you want to do this?

Kate


Top
 Profile  
 
 Post subject: Re: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 7:40 am 
Beginner
Beginner

Joined: Fri Nov 05, 2010 7:25 am
Posts: 21
k.libby wrote:
Hi,
It is possible to have tables with identical structure, but they would have to have different names. However splitting records for the same POJO entity across two different tables is not a good idea! Why do you want to do this?

Kate

YEs, it is not a good idea.

We are doing a log(tomcat) analyzer,so we first push all the log to the table per day.

So the records in the table will grow speedly!

That's why we look for a way to slove this problem.


Top
 Profile  
 
 Post subject: Re: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 8:11 am 
Beginner
Beginner

Joined: Fri Nov 26, 2010 8:25 am
Posts: 21
Hi,

You cannot create more than one identical table so that would not work. Storing raw logs in a database probablty isnt the best solution, it would be better to store structured data after processing the logs which would work well in a database.

Hope that helps,

Kate


Top
 Profile  
 
 Post subject: Re: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 8:17 am 
Beginner
Beginner

Joined: Fri Nov 05, 2010 7:25 am
Posts: 21
k.libby wrote:
Hi,

You cannot create more than one identical table so that would not work. Storing raw logs in a database probablty isnt the best solution, it would be better to store structured data after processing the logs which would work well in a database.

Hope that helps,

Kate


This is the structure of the table:

Code:
username bytes  uri              method  status refer    browser platform
admin      2333  /login.action get        200     google IE6        Winxp

The log pushed to table is filtered yet,some raw request(http:/.../xx.gif is excluded).

Even so,the records will grow also. One year two years later?


Top
 Profile  
 
 Post subject: Re: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 9:03 am 
Beginner
Beginner

Joined: Fri Nov 26, 2010 8:25 am
Posts: 21
Hi,

Having large numbers of records in a table is not necessarily problem, they can frequently run into millions of records without encountering performance issues. However, if you have concerns you might want to consider partitioning. How you do this will depend highly on what database you are using, and you would need configure this separately. Hibernate has no inherent support for partitioning but it is possible to manipulate Hibernate so that it can access partioned tables. A quick search has thrown up this article: http://blog.xebia.com/2006/07/31/partitioning-in-hibernate/ which you may want to take a look at.

Hope that gives you some guidance,
Kate.


Top
 Profile  
 
 Post subject: Re: one entity Multiple tables
PostPosted: Mon Nov 29, 2010 9:32 am 
Beginner
Beginner

Joined: Fri Nov 05, 2010 7:25 am
Posts: 21
k.libby wrote:
Hi,

Having large numbers of records in a table is not necessarily problem, they can frequently run into millions of records without encountering performance issues. However, if you have concerns you might want to consider partitioning. How you do this will depend highly on what database you are using, and you would need configure this separately. Hibernate has no inherent support for partitioning but it is possible to manipulate Hibernate so that it can access partioned tables. A quick search has thrown up this article: http://blog.xebia.com/2006/07/31/partitioning-in-hibernate/ which you may want to take a look at.

Hope that gives you some guidance,
Kate.

Thanks for your kind.:)

In fact ,I have thought of partitioning in mysql,and I think it is not related to the oRM framework. But even thougth,we are afriad of put all the data in one table. :(

Form your answer,and that article,I decide not map one entity to multiple tables. I will use the partitioning in mysql when needed.

Thank you very much. :)


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.