springside / springside4

A Spring Framework based, pragmatic style JavaEE application reference architecture.
http://www.springside.io
Apache License 2.0
5.72k stars 2.91k forks source link

JAP实体类怎么自动生成 #571

Open setsuna opened 7 years ago

setsuna commented 7 years ago

// JPA实体类的标识 @Entity public class Book {

public static final String STATUS_IDLE = "idle";
public static final String STATUS_REQUEST = "request";
public static final String STATUS_OUT = "out";

// JPA 主键标识, 策略为由数据库生成主键
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;

public String doubanId;

public String title;

public String url;

public String status;

@ManyToOne
@JoinColumn(name = "owner_id")
public Account owner;

public Date onboardDate;

@ManyToOne
@JoinColumn(name = "borrower_id")
public Account borrower;

public Date borrowDate;

public Book() {
}

public Book(Long id) {
    this.id = id;
}

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this);
}

}