ferguman wrote:
Hi,
Have you tried running the sql directly against both databases? I'm assuming that you have different db's in the test and developer environments which may be a bad assumption.
i did, it gave the correct results. also we tried to connect to the test database from the developer environment, and still we could not reproduce the problem... :(
Quote:
Also, if you could post your hibernate mapping file that might help forum users to debug your issue.
we dont have mapping file, we used annotations.
the two classes in question:
Code:
import ...;
@Entity
@Table(name = "PLANNER", uniqueConstraints = {})
public class Planner extends Users implements Cloneable {
// Fields
private List<TechnicalChangePart> changeParts;
private List<UploadedPackage> uploadedPackages;
private Plannercompany plannercompany;
private String phone;
private List<Orders> orderses = new ArrayList<Orders>(0);
private PlannerStatus status;
@OneToMany(cascade= {CascadeType.PERSIST}, fetch=FetchType.LAZY, mappedBy="planner")
@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public List<TechnicalChangePart> getChangeParts() {
return changeParts;
}
public void setChangeParts(List<TechnicalChangePart> changeParts) {
this.changeParts = changeParts;
}
@ManyToOne(cascade = {CascadeType.PERSIST}, fetch = FetchType.LAZY)
@JoinColumn(name = "FK_PLANNER_PLANNERCOMPANY", unique = false, nullable = true, insertable = true, updatable = true)
@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
private Plannercompany getPlannercompanyx() {
return this.plannercompany;
}
private void setPlannercompanyx(Plannercompany plannercompany) {
this.plannercompany = plannercompany;
}
@Transient
public Plannercompany getPlannercompany() {
return getPlannercompanyx();
}
@Transient
public void setPlannercompany(Plannercompany plannercompany) {
if (this.plannercompany != null) {
this.plannercompany.getPlanners().remove(this);
}
if (plannercompany != null) {
plannercompany.getPlanners().add(this);
}
this.plannercompany = plannercompany;
}
@Column(name = "PHONE", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Enumerated(EnumType.ORDINAL)
@Column(name = "STATUS", unique = false, nullable = false, insertable = true, updatable = true, length = 1)
public PlannerStatus getStatus() {
return this.status;
}
public void setStatus(PlannerStatus status) {
this.status = status;
}
@OneToMany(cascade = { CascadeType.PERSIST }, fetch = FetchType.LAZY, mappedBy = "plannerx")
@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public List<Orders> getOrderses() {
return this.orderses;
}
public void setOrderses(List<Orders> orderses) {
this.orderses = orderses;
}
@OneToMany(cascade= {CascadeType.PERSIST}, fetch= FetchType.LAZY, mappedBy="planner")
@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public List<UploadedPackage> getUploadedPackages() {
return uploadedPackages;
}
public void setUploadedPackages(List<UploadedPackage> parts) {
this.uploadedPackages = parts;
}
}
and
Code:
import ...;
@Entity
@Table(name = "USERS", uniqueConstraints = {})
@Inheritance(strategy = InheritanceType.JOINED)
public class Users extends HibernateObject {
// Fields
private String username;
private String email;
private String name;
private List<TechnicalChange> technicalChanges = new ArrayList<TechnicalChange>(
0);
private List<PostOfficeUser> postOfficeUsers = new ArrayList<PostOfficeUser>(0);
@Column(name = "USERNAME", unique = true, nullable = false, insertable = true, updatable = true, length = 100)
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(name = "EMAIL", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(name = "NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(cascade = { CascadeType.PERSIST }, fetch = FetchType.LAZY, mappedBy = "usersx")
@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public List<TechnicalChange> getTechnicalChanges() {
return this.technicalChanges;
}
public void setTechnicalChanges(List<TechnicalChange> technicalChanges) {
this.technicalChanges = technicalChanges;
}
@OneToMany(cascade = { CascadeType.PERSIST }, fetch = FetchType.LAZY, mappedBy = "usersx")
@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public List<PostOfficeUser> getPostOfficeUsers() {
return this.postOfficeUsers;
}
public void setPostOfficeUsers(List<PostOfficeUser> postOfficeUsers) {
this.postOfficeUsers = postOfficeUsers;
}
}