-->
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.  [ 3 posts ] 
Author Message
 Post subject: One-to-Many not populating objects when a List is returned
PostPosted: Tue Nov 16, 2010 11:27 am 
Newbie

Joined: Mon Oct 19, 2009 5:44 pm
Posts: 6
I have an issue when trying to load a one-to-many relationship when a List of objects are returned.

I'm using a join table named article_image between my article table and the image table.

tables:
article(article_id)
image(image_id)
article_image(article_id, image_id)

Code:
@Component
@Entity
@Indexed
@Table(name="article")
@FullTextFilterDef(name="notActive", impl=ActiveArticleFilterFactory.class)
public class Article implements java.io.Serializable {

@OneToMany(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
   @JoinTable(name = "article_image",
       joinColumns = {
         @JoinColumn(name="article_id", unique = true)           
       },
       inverseJoinColumns = {
         @JoinColumn(name="image_id")
       }
     )
   private Set<Image> articleImages = new HashSet<Image>(0);


If I do a findByID() on Article where only the single instance is returned the articleImages Set is populated. But if I do a findByProperty() or anything else where a list of Article is returned articleImages is always empty.

Any thoughts? Do you need to see anything else?


Top
 Profile  
 
 Post subject: Re: One-to-Many not populating objects when a List is returned
PostPosted: Tue Nov 16, 2010 7:54 pm 
Newbie

Joined: Mon Oct 19, 2009 5:44 pm
Posts: 6
Anyone?


Top
 Profile  
 
 Post subject: Re: One-to-Many not populating objects when a List is returned
PostPosted: Wed Nov 17, 2010 12:24 pm 
Newbie

Joined: Mon Oct 19, 2009 5:44 pm
Posts: 6
Still stuck on this. It seems like it should just be something trivial. I've been trying anything I can find.


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