-->
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.  [ 1 post ] 
Author Message
 Post subject: Build-up of keys to create primary key of assocation classes
PostPosted: Fri Feb 06, 2015 9:57 am 
Beginner
Beginner

Joined: Fri Sep 14, 2012 10:41 am
Posts: 20
I am writing an application of social network type. In this type of application, it's necessary to make use of "association tables". An association table is when an association has its own separate table made up of two columns only which are the row ids of each object (entity) on both sides of the association. It is also possible to put additional attributes in the association table and map it to its separate class called association class (see Hibernate in Action - page 226, page 229).

In my social network application, this type of associations tend to pile on each other and an excessive amalgamation of row ids to create a primary key , therein lies the problem.

I have situations where an association class has container of another class like one to many. This requires that the double-id be put into each

I have a few situations where two association classes have a new association between each other. It's necessary for me to create a new association class with now 4 different row ids (two from each association classes it was built from) for its primary id.

Further more, I have situations where there is yet another level of association with two classes with multiple ids, one association class has 2 ids and the other has 4 ids. That would create a new association class with 6 ids! That seems excessive! There has to be a better solution!

MY SOLUTION!

I think that the hibernate team has to review the whole idea of association classes and make a few changes to avoid having to append ids to create a new id for the association class.

I suggest to make any association class have a single id made of single integer or long, like other tables. The new association table would carry the two ids from its left/right classes as FOREIGN KEY, not primary key like it is done right now. This would give the benefits of both worlds.

Simple container on the association class would be done with the single primary key, just like any normal class.

Building association classes with association classes will create a normal class with a single primary key. Searches with the double key would be done with the two foreign keys.

This change would greatly improve Hibernate and give it a level of power it does not have right now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.