Note, ํด์ํ๊ทธ๋ฅผ ์ ์ฅํ๋ Hashtag, ๊ทธ๋ฆฌ๊ณ ์ค๊ฐ ํ
์ด๋ธ์ธ NoteHashtag ๊ฐ ์๋ค. @OneToMany(mappedBy = "note")
private Set<Hashtag> hashtags = new HashSet<>();
@OneToMany(mappedBy = "hashtags")
private Set<Note> notes = new HashSet<>();
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "note_id")
private Note note;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "hashtag_id")
private Hashtag hashtag;

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Cannot invoke "org.hibernate.mapping.ToOne.getReferencedEntityName()" because "toOne" is null
NoteHashtag ๋ Note ์ ์ข
์์ ์ธ ๊ฐ๋
์ด๊ธฐ๋๋ฌธ์ ํด๋น ํ๋๋ก ์ฐพ์๊ฐ์ cascade = CascadeType.ALL ์ต์
์ ๊ฑธ์ด์ฃผ๋ฉด ๋๋ค๋ ๊ฒฐ๋ก ์ ๋ด๋ฆฌ๊ณ Note ์ Hashtag ๊ฐ๊ฐ์ ์ฐพ์๊ฐ๋ณด๋ FK ์ฐธ์กฐ(?)๊น์ง ์๋ชป ๋์ด ์์๋ค!cascade = CascadeType.ALL ์ต์
์ ๊ฑธ์ด์ฃผ์๋ค.mappedBy ์ ๊ฐ ๋ํ ํด๋น ํ๋์ ์ด๋ฆ์ผ๋ก ๋ฐ๊ฟ์ฃผ์๋ค. @OneToMany(mappedBy = "note", cascade = CascadeType.ALL)
private Set<NoteHashtag> noteHashtags = new HashSet<>();
@OneToMany(mappedBy = "hashtag", cascade = CascadeType.ALL)
private Set<NoteHashtag> noteHashtags = new HashSet<>();