Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD : Review Controller/Entity/Repository, Comment Entity #5

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/java/com/shopping/jpa/controller/ReviewController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.shopping.jpa.controller;

import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Controller
@Transactional
public class ReviewController {
@PersistenceContext
EntityManager entityManager;

//TODO : CRUD
}
16 changes: 16 additions & 0 deletions src/main/java/com/shopping/jpa/model/Comment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.shopping.jpa.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class Comment {
@Id
@GeneratedValue
private Long id;

@Column
private String contents;
}
17 changes: 17 additions & 0 deletions src/main/java/com/shopping/jpa/model/Review.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.shopping.jpa.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.List;

@Entity
public class Review {
@Id
@GeneratedValue
private Long id;

@Column
private List<Comment> comments;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.shopping.jpa.repository;

import com.shopping.jpa.model.Review;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
interface ReviewRepository extends JpaRepository<Review, Long> {
}