-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
257 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
## Run Jetty Server ## | ||
|
||
mvn clean jetty:run | ||
|
||
|
||
## Connect & Write to DB ## | ||
|
||
http://localhost:9090/write.html?title=aaa&content=bbb |
This file contains 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
This file contains 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
9 changes: 0 additions & 9 deletions
9
06-spring-db-jpa/src/main/java/ex/spring/dao/ArticleRepository.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
06-spring-db-jpa/src/main/java/ex/spring/dao/ParentRepository.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ex.spring.dao; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import ex.spring.model.Parent; | ||
|
||
public interface ParentRepository extends JpaRepository<Parent, Long> { | ||
Parent getOne(Long id); | ||
|
||
@Override | ||
Parent save(Parent b); | ||
} |
15 changes: 0 additions & 15 deletions
15
06-spring-db-jpa/src/main/java/ex/spring/model/Article.java
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package ex.spring.model; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
|
||
@Entity(name="grade") | ||
public class Child implements Serializable { | ||
@Id | ||
@GeneratedValue(strategy=GenerationType.AUTO) | ||
private Long sid; | ||
|
||
@JoinColumn(name = "parentId") | ||
private Long parentId; | ||
|
||
public Long getSid() { | ||
return sid; | ||
} | ||
|
||
public void setSid(Long sid) { | ||
this.sid = sid; | ||
} | ||
|
||
|
||
public Long get성적표() { | ||
return parentId; | ||
} | ||
|
||
public void set성적표(Long bookCategory) { | ||
this.parentId = bookCategory; | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
06-spring-db-jpa/src/main/java/ex/spring/model/Parent.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package ex.spring.model; | ||
|
||
import java.util.List; | ||
|
||
import javax.persistence.CascadeType; | ||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.OneToMany; | ||
|
||
@Entity(name="sheet") | ||
public class Parent { | ||
@Id | ||
@GeneratedValue(strategy=GenerationType.AUTO) | ||
private Long id; | ||
|
||
@Embedded private User user; | ||
|
||
private String 평균; | ||
private Long 석차; | ||
private String 성명; | ||
|
||
// @OneToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL) | ||
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.PERSIST) | ||
@JoinColumn(name="parentId") | ||
private List<Child> 중간고사; | ||
|
||
// @OneToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL) | ||
// @JoinColumn(name="id") | ||
// private List<성적> 기말고사; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
public String get평균() { | ||
return 평균; | ||
} | ||
public void set평균(String 평균) { | ||
this.평균 = 평균; | ||
} | ||
public Long get석차() { | ||
return 석차; | ||
} | ||
public void set석차(Long 석차) { | ||
this.석차 = 석차; | ||
} | ||
public String get성명() { | ||
return 성명; | ||
} | ||
public void set성명(String 성명) { | ||
this.성명 = 성명; | ||
} | ||
public List<Child> get중간고사() { | ||
return 중간고사; | ||
} | ||
public void set중간고사(List<Child> 중간고사) { | ||
this.중간고사 = 중간고사; | ||
} | ||
// public List<성적> get기말고사() { | ||
// return 기말고사; | ||
// } | ||
// public void set기말고사(List<성적> 기말고사) { | ||
// this.기말고사 = 기말고사; | ||
// } | ||
public void setUser(User user2) { | ||
this.user = user2; | ||
} | ||
|
||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ex.spring.model; | ||
|
||
import javax.persistence.Embeddable; | ||
|
||
@Embeddable | ||
public class User { | ||
private String home; | ||
|
||
public User(){} | ||
|
||
public User(String string) { | ||
this.home = string; | ||
} | ||
|
||
public String getHome() { | ||
return home; | ||
} | ||
|
||
public void setHome(String home) { | ||
this.home = home; | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
06-spring-db-jpa/src/main/java/ex/spring/service/BoardService.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
06-spring-db-jpa/src/main/java/ex/spring/service/BoardServiceImpl.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
06-spring-db-jpa/src/main/java/ex/spring/service/ParentService.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package ex.spring.service; | ||
|
||
public interface ParentService { | ||
void save(Long id); | ||
} |
Oops, something went wrong.