Skip to content

Commit

Permalink
Merge pull request #20 from SSUMC-7th/nunu/#6
Browse files Browse the repository at this point in the history
[Nunu/#6] Chapter 6. JPA 활용
  • Loading branch information
Ssamssamukja authored Nov 8, 2024
2 parents b1f89e0 + 19b5ea1 commit ded4f92
Show file tree
Hide file tree
Showing 22 changed files with 901 additions and 4 deletions.
40 changes: 40 additions & 0 deletions spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ 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"
id 'antlr'
}

group = 'umc'
Expand Down Expand Up @@ -31,8 +33,46 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// 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"
}

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


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

// Querydsl 설정부
def generated = 'src/main/generated'

querydsl {
jpa = true
querydslSourcesDir = generated
}

sourceSets {
main.java.srcDir generated
}

compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}
64 changes: 64 additions & 0 deletions spring/src/main/generated/umc/spring/domain/QComment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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;


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

private static final long serialVersionUID = -572500941L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QComment comment = new QComment("comment");

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

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

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

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

public final QMember member;

public final QReview review;

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

public QComment(String variable) {
this(Comment.class, forVariable(variable), INITS);
}

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

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

public QComment(PathMetadata metadata, PathInits inits) {
this(Comment.class, metadata, inits);
}

public QComment(Class<? extends Comment> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.member = inits.isInitialized("member") ? new QMember(forProperty("member")) : null;
this.review = inits.isInitialized("review") ? new QReview(forProperty("review"), inits.get("review")) : null;
}

}

61 changes: 61 additions & 0 deletions spring/src/main/generated/umc/spring/domain/QFavoriteFood.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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;


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

private static final long serialVersionUID = 1905081030L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QFavoriteFood favoriteFood = new QFavoriteFood("favoriteFood");

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.Food> food = createEnum("food", umc.spring.domain.enums.Food.class);

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

public final QMember member;

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

public QFavoriteFood(String variable) {
this(FavoriteFood.class, forVariable(variable), INITS);
}

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

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

public QFavoriteFood(PathMetadata metadata, PathInits inits) {
this(FavoriteFood.class, metadata, inits);
}

public QFavoriteFood(Class<? extends FavoriteFood> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.member = inits.isInitialized("member") ? new QMember(forProperty("member")) : null;
}

}

65 changes: 65 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,65 @@
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;


/**
* 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 StringPath birth = createString("birth");

//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 StringPath name = createString("name");

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

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

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

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

//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);
}

}

65 changes: 65 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,65 @@
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);

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

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

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

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

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

public final QRestaurant restaurant;

//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.restaurant = inits.isInitialized("restaurant") ? new QRestaurant(forProperty("restaurant")) : null;
}

}

47 changes: 47 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,47 @@
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;


/**
* 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");

//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 ded4f92

Please sign in to comment.