I observed a strange situation using JPA in case of detached object.
If I want to use the Tenant (see bellow) object in JSF page accept the
tenantId field all fields are NULL. But before the return statement if
I access any of the member variable of Tenant Object it works file. I
tried with FetchType.Eager, but no luck.
Is it a known feature or BUG?
This is my entity class a Tenant has one or more user.
@Entity
public class Tenant{
@OneToMany(mappedBy="tenant", cascade=CascadeType.ALL)
Collection<User> hmsUserList = new ArrayList<User>();
.....
}
@Entity
public class User{
@ManyToOne
@JoinColumn(name="tenant_id")
private Tenant tenant;
....
}
My function returns the Tenant Object as;
public Tenant myFunction(){
User user = em.find(User.class, ID);
//if add the bellow line it works
// user.getTenant().getName();
return user.getTenant();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---