I am using Hibernate, Spring and Dozer in my project .
My Problem is that that I am unable to Load Lazy fetching Collection(List). I am using Dozer to convert entity class into (Dto) class. I think Dozer user Know these things.
When I debug then I get all data from DB in entity class but when I converted into Dto through Dozer I get null in Collection which is Lazy Fetched.
Please help me out here. Thanks in advance!
I am unable to get Developer List when I Converted entity to Dto. I have exact Dto classes name Developer
and Founder
and I map these in String Configuration File. I tried @Select
On join table then its loaded and working fine but I don't want that way . If I have to make extra function in my servicemanager class then help me .
@Entity
@Table(name = "table")
public class Founder {
@Id
@Column(name = "foun_id")
@GeneratedValue(generator = "uuid")
private String id;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = false)
@JoinColumn(name = "reg_address_id")
private Address registeredAddress;
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(name = "jointable", joinColumns = { @JoinColumn(name = "foun_id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "dev_id", nullable = true) })
private List<Developer> developer;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Address getRegisteredAddress() {
return registeredAddress;
}
public void setRegisteredAddress(Address registeredAddress) {
this.registeredAddress = registeredAddress;
}
public List<Developer> getDeveloper() {
return developer;
}
public void setDeveloper(List<Developer> developer) {
this.developer = developer;
}
}
@Entity
@Table(name = "tbl")
public class Developer {
@Id
@Column(name = "dev_id")
@GeneratedValue(generator = "uuid")
private String id;
@Column(name = "file_number")
private String fileNumber;
@Column(name = "flat_info")
private String flatInfo;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = false)
@JoinColumn(name = "address_id")
private Address address;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFileNumber() {
return fileNumber;
}
public void setFileNumber(String fileNumber) {
this.fileNumber = fileNumber;
}
public String getFlatInfo() {
return flatInfo;
}
public void setFlatInfo(String flatInfo) {
this.flatInfo = flatInfo;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}