-->
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: New User - mapping collections
PostPosted: Wed Aug 25, 2010 5:19 pm 
Newbie

Joined: Wed Aug 25, 2010 3:47 pm
Posts: 1
I've done a lot of searching on this... haven't found my answer yet.

A simplified representation of my problem :


Code:
@Entity
@Table(name="A")
Public Class A {

   private Long id;
   @Id
   @GeneratedValue
   @Column(name="a_id")
   public Long getId() { return id; }
   public void setId(Long id) { this.id = id; }

   protected List<B> blist = new ArrayList<B>();
   @OneToMany(cascade=CascadeType.ALL)
   @JoinTable(name="ab_join", joinColumns=@JoinColumn(name="fk_a"), inverseJoinColumns=@JoinColumn(name="fk_b"))
   public List<B> getBlist() { return blist; }
   public void setBlist(List<B> list) { blist = list; }   

}

@Entity
@Table(name="B")
Public Class B {

   private Long id;
   @Id
   @GeneratedValue
   @Column(name="b_id")
   public Long getId() { return id; }
   public void setId(Long id) { this.id = id; }

   private String aProperty;
   @Column(name="a_property")
   public String getAProperty() { return aProperty; }
   public void setAProperty(String property) { aProperty = property; }
}



When I attempt to create A, the instance of A is created and the properties of A that are in Table A (only 'id' in the above example) are properly persisted. The collection (blist in the example) appears to be created, and I can read it from the session, but it is not persisted/saved to the join table. If I try to force a persist/saved on the collection property, I get the Mapping Exception : "Unknown Entity: java.util.ArrayList".

People have reported some similar issues in other threads, but I haven't found a solution.

thanks much!


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.