Created
April 25, 2019 00:48
-
-
Save barongun/1bc2501886c27a0a86c2c010128bcd2f to your computer and use it in GitHub Desktop.
Entity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.querydsl.core.annotations.QueryProjection; | |
import lombok.EqualsAndHashCode; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import javax.persistence.*; | |
@Getter | |
@Setter | |
@Entity | |
@Table(name = "agent") | |
@NoArgsConstructor | |
@EqualsAndHashCode | |
public class Agent { | |
@Id | |
@Column(name="agent_idx") | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private long agentIdx; | |
@Column(name = "agent_type") | |
@Enumerated(EnumType.STRING) | |
private AgentType agentType; | |
@Transient | |
private String agentNm; | |
@QueryProjection | |
public Agent(long agentIdx, String agentNm) { | |
this.agentIdx = agentIdx; | |
this.agentNm = agentNm; | |
} | |
public Agent(AgentType agentType) { | |
this.agentType = agentType; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.EqualsAndHashCode; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import javax.persistence.*; | |
@Getter | |
@Setter | |
@Entity | |
@Table(name = "layout") | |
@EqualsAndHashCode | |
@NoArgsConstructor | |
public class Layout { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "layout_idx") | |
private long layoutIdx; | |
@Column(name = "i") | |
private int i; | |
@Column(name = "x") | |
private int x; | |
@Column(name = "y") | |
private int y; | |
@Column(name = "w") | |
private int w; | |
@Column(name = "h") | |
private int h; | |
@OneToOne | |
@JoinColumn(name = "agent_idx", referencedColumnName = "agent_idx", nullable = false) | |
private Agent agent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment