-->
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.  [ 2 posts ] 
Author Message
 Post subject: Annotating Relationship mapping of primitives (non-entity)
PostPosted: Mon Mar 07, 2011 3:41 pm 
Newbie

Joined: Mon Mar 07, 2011 3:30 pm
Posts: 1
I'd like to implement a One-To-Many relationship between my entity class and a set of Integers.

in pseudo code...
Code:
@Entity
public class MyClass{
     @Id
     @GeneratedValue
     private Integer id;

     // what to do here
     private Set<Integer> scores;
}


Has anyone got this to work? Ideally I'd like the join table to contain 2 columns, the id of MyClass and a value of scores. The only example hibernate provides is for mapping relationships between two entity classes.

I found information in the links below, but am not sure how/if the issue is resolved. I cant find any information on the @javax.ejb.AssociationTable that the first link mentions.

http://opensource.atlassian.com/projects/hibernate/browse/ANN-19
and
https://forum.hibernate.org/viewtopic.php?t=938240

using hibernate-3.6.0-final, hibernate annotations 3.4.0.GA, jdk-1.6.0.17


Top
 Profile  
 
 Post subject: Re: Annotating Relationship mapping of primitives (non-entity)
PostPosted: Mon Mar 07, 2011 5:10 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
It can be done with the @ElementCollection annotation. See http://docs.jboss.org/hibernate/core/3. ... s-ofvalues for an example.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.