Hibernate+mysql Association Mapper encounters Java.lang.StackOverflowError exception

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.