Can somebody please explain to me why a refresh might not load a child collection.
My code is like:
session.save(student)
transaction.commit()
session.refresh(account)
and the student is not in the refreshed account
From account.java
Code:
@OneToMany(mappedBy="account", fetch=FetchType.EAGER)
public Set<Student> getStudentSet() {
return studentSet;
}
public void setStudentSet(Set<Student> studentSet) {
this.studentSet = studentSet;
}
From student.java
Code:
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn (name="accountId")
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
SQL:
Code:
Hibernate: insert into person (dob, email, firstName, isMale, lastName, note) values (?, ?, ?, ?, ?, ?)
Hibernate: insert into student (accountId, grade, school, personId) values (?, ?, ?, ?)
Hibernate: update account set balance=? where accountId=?
Hibernate: select account0_.accountId as accountId0_0_, account0_.balance as balance0_0_ from account account0_ where account0_.accountId=?