Consider the following code:
@Entity
@Table(name = "a")
public class A implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
public int id;
@Transient
public B b;
public B getB()
{
return B;
}
}
When I fetch A, I'm manually filling B (another hibernate entity). If I try and access by by using a.b, then it fails, but, if I user a.getB(); then it succeeds.
Why is this?