Skip to content

Commit

Permalink
Merge pull request #19 from SSUMC-7th/woody/#6
Browse files Browse the repository at this point in the history
[Woody] Chapter 6. JPA 활용
  • Loading branch information
2ghrms authored Nov 8, 2024
2 parents 71fca06 + 0bb50bf commit 875455c
Show file tree
Hide file tree
Showing 45 changed files with 1,207 additions and 34 deletions.
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/gradle.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

55 changes: 51 additions & 4 deletions spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.3.4'
id 'io.spring.dependency-management' version '1.1.6'
// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}

group = 'umc'
Expand All @@ -12,12 +13,16 @@ java {
languageVersion = JavaLanguageVersion.of(17)
}
}

/*
configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
//compileClasspath에 포함된 모든 라이브러리가 querydsl에서도 사용 가능하게 됨
// QueryDSL 라이브러리를 자동 생성 시에 필요한 경로로 포함
}
*/

repositories {
mavenCentral()
Expand All @@ -26,12 +31,54 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.hibernate.orm:hibernate-core:6.0.2.Final'

implementation 'mysql:mysql-connector-java:8.0.33'

//QueryDSL
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

//Jackson (버전 제거)
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.core:jackson-annotations'
implementation 'com.fasterxml.jackson.core:jackson-core'

//Lombok
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'

implementation 'org.hibernate.validator:hibernate-validator:8.0.0.Final' // Bean Validation
implementation 'org.glassfish:jakarta.el:4.0.2' // Expression Language (EL)
implementation 'org.antlr:antlr4-runtime:4.10' // ANTLR 의존성 추가

// SpringDoc OpenAPI
implementation 'org.springdoc:springdoc-openapi-ui:1.6.9'
implementation 'org.springdoc:springdoc-openapi-data-rest:1.6.9'

//Testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

sourceSets {
main {
java {
srcDirs = ['src/main/java', 'src/main/resources']
}
}
}

tasks.named('test') {
useJUnitPlatform()
}

// Querydsl 설정부
def generated = 'src/main/generated'
clean {
delete file(generated)
}
tasks.withType(JavaCompile) {
options.generatedSourceOutputDirectory = file(generated)
}
52 changes: 52 additions & 0 deletions spring/src/main/generated/umc/spring/domain/QFood.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package umc.spring.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QFood is a Querydsl query type for Food
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QFood extends EntityPathBase<Food> {

private static final long serialVersionUID = -1348495606L;

public static final QFood food = new QFood("food");

public final umc.spring.domain.common.QBaseEntity _super = new umc.spring.domain.common.QBaseEntity(this);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

public final EnumPath<umc.spring.domain.enums.FoodCategory> foodCategory = createEnum("foodCategory", umc.spring.domain.enums.FoodCategory.class);

public final NumberPath<Long> id = createNumber("id", Long.class);

public final ListPath<umc.spring.domain.mapping.MemberPreferFood, umc.spring.domain.mapping.QMemberPreferFood> memberPreferFoodList = this.<umc.spring.domain.mapping.MemberPreferFood, umc.spring.domain.mapping.QMemberPreferFood>createList("memberPreferFoodList", umc.spring.domain.mapping.MemberPreferFood.class, umc.spring.domain.mapping.QMemberPreferFood.class, PathInits.DIRECT2);

public final BooleanPath preferOptional = createBoolean("preferOptional");

//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public QFood(String variable) {
super(Food.class, forVariable(variable));
}

public QFood(Path<? extends Food> path) {
super(path.getType(), path.getMetadata());
}

public QFood(PathMetadata metadata) {
super(Food.class, metadata);
}

}

74 changes: 74 additions & 0 deletions spring/src/main/generated/umc/spring/domain/QMember.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package umc.spring.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QMember is a Querydsl query type for Member
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QMember extends EntityPathBase<Member> {

private static final long serialVersionUID = 1366956614L;

public static final QMember member = new QMember("member1");

public final umc.spring.domain.common.QBaseEntity _super = new umc.spring.domain.common.QBaseEntity(this);

public final StringPath address = createString("address");

public final DatePath<java.time.LocalDate> birthdate = createDate("birthdate", java.time.LocalDate.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

public final StringPath email = createString("email");

public final EnumPath<umc.spring.domain.enums.Gender> gender = createEnum("gender", umc.spring.domain.enums.Gender.class);

public final NumberPath<Long> id = createNumber("id", Long.class);

public final DatePath<java.time.LocalDate> inactiveDate = createDate("inactiveDate", java.time.LocalDate.class);

public final ListPath<umc.spring.domain.mapping.MemberAgreeTerm, umc.spring.domain.mapping.QMemberAgreeTerm> memberAgreeTermList = this.<umc.spring.domain.mapping.MemberAgreeTerm, umc.spring.domain.mapping.QMemberAgreeTerm>createList("memberAgreeTermList", umc.spring.domain.mapping.MemberAgreeTerm.class, umc.spring.domain.mapping.QMemberAgreeTerm.class, PathInits.DIRECT2);

public final ListPath<umc.spring.domain.mapping.MemberMission, umc.spring.domain.mapping.QMemberMission> memberMissionList = this.<umc.spring.domain.mapping.MemberMission, umc.spring.domain.mapping.QMemberMission>createList("memberMissionList", umc.spring.domain.mapping.MemberMission.class, umc.spring.domain.mapping.QMemberMission.class, PathInits.DIRECT2);

public final ListPath<umc.spring.domain.mapping.MemberPreferFood, umc.spring.domain.mapping.QMemberPreferFood> memberPreferFoodList = this.<umc.spring.domain.mapping.MemberPreferFood, umc.spring.domain.mapping.QMemberPreferFood>createList("memberPreferFoodList", umc.spring.domain.mapping.MemberPreferFood.class, umc.spring.domain.mapping.QMemberPreferFood.class, PathInits.DIRECT2);

public final StringPath name = createString("name");

public final NumberPath<Integer> point = createNumber("point", Integer.class);

public final ListPath<Review, QReview> reviewList = this.<Review, QReview>createList("reviewList", Review.class, QReview.class, PathInits.DIRECT2);

public final EnumPath<umc.spring.domain.enums.SocialType> socialtype = createEnum("socialtype", umc.spring.domain.enums.SocialType.class);

public final StringPath specAddress = createString("specAddress");

public final EnumPath<umc.spring.domain.enums.MemberStatus> status = createEnum("status", umc.spring.domain.enums.MemberStatus.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public QMember(String variable) {
super(Member.class, forVariable(variable));
}

public QMember(Path<? extends Member> path) {
super(path.getType(), path.getMetadata());
}

public QMember(PathMetadata metadata) {
super(Member.class, metadata);
}

}

67 changes: 67 additions & 0 deletions spring/src/main/generated/umc/spring/domain/QMission.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package umc.spring.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QMission is a Querydsl query type for Mission
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QMission extends EntityPathBase<Mission> {

private static final long serialVersionUID = -453449888L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QMission mission = new QMission("mission");

public final umc.spring.domain.common.QBaseEntity _super = new umc.spring.domain.common.QBaseEntity(this);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

public final DatePath<java.time.LocalDate> dueDate = createDate("dueDate", java.time.LocalDate.class);

public final NumberPath<Long> id = createNumber("id", Long.class);

public final ListPath<umc.spring.domain.mapping.MemberMission, umc.spring.domain.mapping.QMemberMission> memberMissionList = this.<umc.spring.domain.mapping.MemberMission, umc.spring.domain.mapping.QMemberMission>createList("memberMissionList", umc.spring.domain.mapping.MemberMission.class, umc.spring.domain.mapping.QMemberMission.class, PathInits.DIRECT2);

public final StringPath missionSpec = createString("missionSpec");

public final NumberPath<Integer> reward = createNumber("reward", Integer.class);

public final QStore store;

//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public QMission(String variable) {
this(Mission.class, forVariable(variable), INITS);
}

public QMission(Path<? extends Mission> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QMission(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QMission(PathMetadata metadata, PathInits inits) {
this(Mission.class, metadata, inits);
}

public QMission(Class<? extends Mission> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.store = inits.isInitialized("store") ? new QStore(forProperty("store"), inits.get("store")) : null;
}

}

50 changes: 50 additions & 0 deletions spring/src/main/generated/umc/spring/domain/QRegion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package umc.spring.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QRegion is a Querydsl query type for Region
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QRegion extends EntityPathBase<Region> {

private static final long serialVersionUID = 1509930656L;

public static final QRegion region = new QRegion("region");

public final umc.spring.domain.common.QBaseEntity _super = new umc.spring.domain.common.QBaseEntity(this);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;

public final NumberPath<Long> id = createNumber("id", Long.class);

public final StringPath name = createString("name");

public final ListPath<Store, QStore> StoreList = this.<Store, QStore>createList("StoreList", Store.class, QStore.class, PathInits.DIRECT2);

//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public QRegion(String variable) {
super(Region.class, forVariable(variable));
}

public QRegion(Path<? extends Region> path) {
super(path.getType(), path.getMetadata());
}

public QRegion(PathMetadata metadata) {
super(Region.class, metadata);
}

}

Loading

0 comments on commit 875455c

Please sign in to comment.