openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <cob...@windstream.net>
Subject Re: Mapping a collection of entities...
Date Wed, 19 Nov 2008 02:01:29 GMT
Thanks for the quick reply.  I'll give that a shot.

---- Wes Wannemacher <wesw@wantii.com> wrote: 
> 
> On Tue, 2008-11-18 at 19:36 -0600, cobbra@windstream.net wrote:
> > Hello all,
> > 
> > I'm trying to teach myself OpenJPA and failing miserably...  
> > I have two entities (code below) where one contains a collection 
> > of the other.  The intent is for UserInfo to be able to contain 
> > a collection (or List) of an arbitrary number of UserProperties.  
> > The UserProperties are defined at run-time by data entered through 
> > the application.
> > 
> 
> I'm a bit of a newb myself, but I think you need to change your
> UserProperties like below -
> 
> 
> 
> @Entity
> @Table(name="userproperties")
> public class UserProperties implements Serializable {
> 
> 	@Id
> 	@Column(name="id", nullable=false)
> 	@GeneratedValue(strategy=GenerationType.IDENTITY)
> 	private Integer id;
> 	
> 	@ManyToOne(mappedBy="UserInfo", fetch=FetchType.LAZY)
> 	@JoinColumn(name="user_id", referencedColumnName="id")
> 	private UserInfo userInfo;
>

Mime
View raw message