package com.zyp.jpa2; import java.util.Calendar; import java.util.Collection; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.Lob; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity // @Table(name = "EMPLOYEE", schema = "HR") @Table(name = "EMPLOYEE", catalog = "HR") public class Employee { @Id @Column(name = "emp_id") @GeneratedValue(strategy = GenerationType.AUTO) @TableGenerator(name = "key_gen", table = "id_gen", pkColumnName = "gen_name", valueColumnName = "gen_value", initialValue = 10000, allocationSize = 100) // @GeneratedValue(generator="key_gen") private int id; private String name; private long salary; @ManyToMany @JoinTable(name="EMP_PROJ", joinColumns=@JoinColumn(name="EMP_ID"), inverseJoinColumns=@JoinColumn(name="PROJ_ID")) private Collection<Project> projects; @ManyToOne @JoinColumn(name = "DEPT_ID") private Department department; @OneToOne @JoinColumn(name = "PSPACE_ID") private ParkingSpace parkingSpace; @Lob @Column(name = "pic") @Basic(fetch = FetchType.LAZY) private byte[] picture; @Enumerated(EnumType.STRING) private Type type; @Temporal(TemporalType.DATE) private Date startDate; @Temporal(TemporalType.DATE) private Calendar dob; transient private String translater; public Employee() { } public Employee(int id) { this.id = id; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getSalary() { return salary; } public void setSalary(long salary) { this.salary = salary; } } enum Type { T1, T2, T3 }
最近浏览更多
flygrass LV12
2023年12月7日
zmlzsw LV8
2021年12月10日
1171120570 LV1
2020年12月18日
zuiwomengjiaren LV11
2020年9月4日
zhengshuang LV1
2020年5月31日
vpv123
2020年3月7日
暂无贡献等级
Jay1109 LV1
2019年12月11日
Lee9527 LV1
2019年9月12日
dd168168
2019年8月26日
暂无贡献等级
zxx521125 LV9
2019年8月26日