Hibernate+mysql Association Mapper encounters Java.lang.StackOverflowError exception
Cause the output of one side of a property corresponding to an attribute in the ToString method of a multi-party when making an association map
Like what:
a party to:
@Entity
@Table (name = "App", schema = "", Catalog = "Game")
public class Appentity {
@Id
@Column (name = "AppId")
Private String appId;
@Basic
@Column (name = "AppName")
Private String AppName;
@Basic
@Column (name = "Appdesc")
Private String Appdesc;
@Basic
@Column (name = "Provider")
Private String provider;
@Basic
@Column (name = "Version")
Private String version;
@Basic
@Column (name= "Posttime")
Private Long posttime;
@Basic
@Column (name = "UpdateTime")
Private Long UpdateTime;
@OneToMany (mappedby = "appentity", fetch = Fetchtype.eager)
private set<productentity> productentities;
@OneToMany (Mappedby = "appentity", Fetch = Fetchtype.lazy)
Private set<ordersentity> ordersentities;
many of the parties
@Entity
@Table (name = "Product", schema = "", Catalog = "Game")
@IdClass (productentitypk.class)
public class ProductEntity {
@Id
@Column (name = "App Id ")
private String appId;
@Id
@GeneratedValue
@Column (name = "ProductId")
Private long productId;
@Basic
@Column (name = "ProductName")
private String productName;
@Basic
@Column (name = "Productdesc")
private String Productdesc;
@Basic
@Column (name = ' price ')
private long price;
@ManyToOne (fetch = Fetchtype.eager)
@JoinColumn (name=" AppId ", insertable = false, updatable = False)
private appentity appentity;
@Override
Public String toString () {
Return "productentity{" +
"Appid=" + appId + ' + ' +
", productid=" + ProductId +
", productname= '" + productName + "+
", productdesc= '" + productdesc + "+
", appentity=" + appentity +
‘}‘;
}
", appentity=" + appentity +
Hibernate+mysql Association Mapper encounters Java.lang.StackOverflowError exception