-->
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: table design for hibernate same columns reused in @ManyToOne
PostPosted: Sat Jun 22, 2013 10:37 am 
Newbie

Joined: Sat Sep 10, 2011 7:43 pm
Posts: 3
Hi,

I'm designing a new feature which will have 4 tables as follows:

table: log_records
table: feature1 mappings
table: feature2 mappings
table: unmapped

log records can contain 3 kinds of records: feature1, feature2 and remainder

The join between log_records and feature 1 will be col1, col2
The join beween log_records and feature 2 will be col1, col2, col3 and col4
The join will be exclusive ie if join log_records to feature1 by col1 and col2 then it could never be joined to feature2
Any records not found by joining to feature1 and feature2 will be inserted separately into table "unmapped"

Does this seem like a candidate for hibernate mappings?

I was able to define a @OneToMany in both feature1 and feature2 and join using @JoinColumns(@JoinColumn, @JoinColumn)

But I believe it's more usual to have the @OneToMany have just (mappedBy="") and not have the joincolumns

When I tried to use @JoinColumns (twice) in the log_records hibernate complained that columns were being declared more than once.

I suppose I would like to know if I'm on the right track.
I have the unidirectional working
But can't get the bi-directional working

I could possibly try with EmbeddedKey / Embeddable ? But will I have the same problems.

Thanks in advance


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.