Skip to content

Commit

Permalink
Feat: 연관 엔티티 매핑 #22
Browse files Browse the repository at this point in the history
- Room, City, AccommodationType 매핑
  • Loading branch information
devjun10 committed May 27, 2022
1 parent d0a3797 commit 7579e19
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.airbnb.business.domain.accommodation;

import lombok.Getter;

@Getter
public enum AccommodationType {

HOUSE("개인 주택"),
HOTEL("호텔"),
GUEST_HOUSE("게스트 하우스"),
PENSION("펜션");

private final String value;

AccommodationType(String value) {
this.value = value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.airbnb.business.domain.accommodation;

import javax.persistence.*;

@Entity
public class City {

@Id
@Column(name = "city_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer cityId;

private String nation;

private String name;

private String image;

public City(String nation, String name, String image) {
this.nation = nation;
this.name = name;
this.image = image;
}

protected City(){}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.airbnb.business.domain.accommodation;

import lombok.Getter;

import javax.persistence.Embeddable;

@Getter
@Embeddable
public class Room {

private int bedRooms;
private int beds;
private int bathRooms;

public Room(int beds, int bathRooms, int bedRooms) {
this.beds = beds;
this.bathRooms = bathRooms;
this.bedRooms = bedRooms;
}

public Room() {
}
}

0 comments on commit 7579e19

Please sign in to comment.