-->
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: Mapping an Array of Database IDs without the Entities
PostPosted: Sat Sep 13, 2014 4:16 am 
Newbie

Joined: Thu Dec 30, 2004 7:44 am
Posts: 15
Greetings, I am searching for the right way to map the following model.

@Entity
class Container {
@Id
private Long id;

@??
private Set<Int> memberIDs;
}

The goal is that the memberIDs are actually other primary key IDs in the database but I don't want to actually link the models of these two particular models, the Container and the Member. The reasons for this are varied but the short version is I have to decide what to store inside the container and I don't want each of the members to be embedded in the object. These objects will be rendered to JSON and there is a decision to make about embedding.

I would like the above scenario to map to a join table so that those using SQL can still see the correct data. The join table would look like any other join table in the database in that it would have the ids and the foreign keys to the actual table containing the member objects.

Is there any way I can do this easily in hibernate? What mapping parameters would i need to put on the entity to have this map and store correctly.


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.