• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to store normalized OneToMany records with Java EE 5 (GF2.1 & MySQL)

Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I would like to find out how to store only a single record in a OneToMany table mapping relationship. Below is an example of what I am try to achieve:

Family (OneToMany) Telephone (ManyToOne)
------------------------------ -----------------------------------
John Smith (father) 1234-5678 (phone line)
Joyce Smith (mother) 1234-5678 (phone line)
Holy Smith (daughter) 1234-5678 (phone line)
Christopher (son) 1234-5678 (phone line)

Currently, the Telephone table is filled up with the same record 4 times which makes it harder to maintain and slow down searches over time, not to mentioned the unnecessary redundant inserts.

I am wondering whether it is possible to maintain a single Telephone record reference by the whole family. This proposition seems to inclined to the ManytoOne relationship even though it can also be a ManyToMany.

My Java EE 5 (JDK1.6.017, Glassfish 2.1) JMS Session Bean application is persisting the records correctly but grinds to a halt after having processed a 600,000 thousand records on the Telephone tables in MySQL (Windows XP). The record ratio between Family and Telephone tables are 1:50.

Any suggestion on improving this model in an effort to streamline the database and speed would be much appreciated.


Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!