I've set up a small project as a test. I'm using BlazeDS and JPA with Hibernate on my test server, and flex with with dpHibernate to access the Java entities. Each Java entity extends BaseEntity, a class that contains ID and UUID fields. The Flex entities are created by DTO2FX.
My problem is that, when I run the Flex project to try and display a few rows from a Users entity, the SQL that is actually being executed is joining every table in my database. This continues until I get java.lang.StackOverflowError. This behavior is completely unexpected, and I'm not really sure where to look to fix the problem. Any suggestions would be greatly appreciated.
Clearly I've left out some details, but I'm hoping this gives a reasonable idea about the project. I would be more than happy to include any code that might be helpful, but I really have no idea what's causing the behavior at the moment. Thanks!
EDIT: Here is a mapping that might better explain the problem.
@Entity
@FXClass(ignoreSuperclasses={Principal.class, UserDetails.class})
@Table(name="edrUser")
public class User extends BaseEntity implements IAbstractEntity, Principal, UserDetails {
@Column(length=20)
private String username;
@ManyToMany(mappedBy="users",fetch=FetchType.LAZY)
private Set<Department> departments = new HashSet<Department>(0);
@ManyToOne
@JoinColumn(name="company_id",nullable=false)
private Company company;
@OneToMany(cascade=CascadeType.ALL, mappedBy="user", fetch=FetchType.LAZY)
private Set<DepartmentJobUserLink> departmentJobUsers = new HashSet<DepartmentJobUserLink>(0);
@Column(length=20)
private String password;
@Column(length=20)
private String forename;
public User(){
super();
}
/* Getters and setters */
}