11-15 06:12
Recent Posts
Recent Comments
Tags
- ์คํฝ์ค๋น
- API MarketPlace ๊ธ๋ก๋ฒ ์ํฌํฐ์ฆ
- ํ์ด์ฌ
- ICT
- Java
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ํ์ด์๊ณต๋ชจ์
- TSQL
- ICT๋ฉํ ๋ง
- ์คํฝ๋ ํ
- ์จ์ผ๋ํ
- linux
- RaspberryPi
- DATABASE
- ์ด๋ธ์
- ํ๋ก๋ณด๋ ธ
- Spring
- ํ์ด์
- DB
- ict๊ณต๋ชจ์
- JOBํ๊ณ
- API๋ง์ผํ๋ ์ด์ค
- ์กํ๊ณ
- ์๋ฐ
- appetizer
- SQL
- mysql
- python
- Naver Cloud
- ์๋์ด๋ ธ
- Today
- Total
miinsun
[JPA] ๋ณตํฉํค ์ค์ ๋ณธ๋ฌธ
๐ JPA ๋ณตํฉํค ์ค์ ํ๋ ๋ฐฉ๋ฒ
๋จผ์ PK ํด๋์ค๋ฅผ ๋ง๋ค์ด ์ค๋ค.
@Data
class UserLikePlacePK implements Serializable{
private String userId;
private int placeId;
}
๋ง๋ค์ด์ค PK ํด๋์ค๋ฅผ JPA ๋๋ฉ์ธ ํด๋์ค์ ์ ์ฉํด์ค๋ค.
@SuppressWarnings("serial")
@Entity
@Table(name="user_like_place")
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@IdClass(UserLikePlacePK.class)
public class UserLikePlace implements Serializable{
@Id
@Column(name = "user_id")
private String userId;
@Id
@Column(name = "place_id")
private int placeId;
@OneToOne
@JoinColumn(name="place_id", insertable = false, updatable = false)
private Place place;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone="Asia/Seoul")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Transient
private String time;
}
'WebApp > Spring' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Comments