-->
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: Set isn't returning items
PostPosted: Wed Aug 06, 2008 2:00 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
I'm having a problem with trying to display the contents of a list.

Every venue has an owner so we have a many to one relationship

Code:
private UserEnt owner;

@ManyToOne
@JoinColumn
@NotNull
public UserEnt getOwner() {
   return owner;
}

public VenueEnt(...,UserEnt owner, ...) {
   ...
   this.owner = owner;
   ...
}


And every owner can have many venues so we have a 1 to many relationship.

Code:
private Set<VenueEnt> ownedVenues = new HashSet<VenueEnt>();

@OneToMany (cascade = {CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "owner", fetch=FetchType.EAGER)
@org.hibernate.annotations.Cascade(value = org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public Set<VenueEnt> getOwnedVenues() {
   return ownedVenues;
}


Why is that when i create a venue and in the constructor i add the user as the owner (and it correctly reflects in the DB), when i do a user.getOwnedVenues() i do not get correct results? Is a particular case, a user is the owner of 3 venues, but on call the set size is 0.

Thanks!


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.