scmoon
@scmoon
Reviews Written
13
Average Rating
4.8
Posts
Q&A
์๋๋ก์ด๋ ์คํ๋์ค์์ ์ด๋ก์ ๋ฒํผ์ด ์๋ณด์ ๋๋ค.
ํด๊ฒฐํ์์ต๋๋ค. ํ๋ก์ ํธ๋ฅผ ์ฒ์์ flutter ๋ก ๋ง๋ค์ด์ผ ํ๋๋ฐ, java ๋ก ๋ง๋ ๋ชจ์์ ๋๋ค.
- 0
- 3
- 172
Q&A
kafka ๋ฅผ ๋์ฐ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ณ ์ข ๋ฃํฉ๋๋ค.
data ๋ด ํ์ผ๋ค์ ์ญ์ ํ๊ณ ์ฌ์์ ํ๋ ๋๋ค์. ๊ฐ์ฌํฉ๋๋ค.
- 0
- 3
- 251
Q&A
QHello Test ์์ ์ค๋ฅ ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค.
H2 ์ ๋ฒ์ ผ์ 1.4.199 ์์ 2.1.214 ๋ก ๋ค์ ์ฌ๋ ค์ ํด๊ฒฐํ์์ต๋๋ค. ํ๋ฃจ ์ ์ง๋ฌธ์์๋ ์คํ๋ง ๋ถํฐ 3.x ์์ 2.1.214 ์คํ์ ๋ถ์ง ์์, 1.4.199 ๋ก ๋ด๋ฆฌ๋ ํด๊ฒฐ๋์๋๋ฐ, ์ง๊ธ ์ด๋ถ๋ถ์ ๋ค์ 2.1.214 ๋ก ํด์ผ ๋์ํ๋ค์. ์ด์ ์ ์ค๋ฅ๋ ์ ๋ฐ์์ํ๋ ์ง๋ ๋ชจ๋ฅด๊ฒ ๋ค์. ์์ผ๋ก ์ด๋ค ์ค๋ฅ๊ฐ ๋ ์ง๋ ๋ชจ๋ฅด๊ฒ ๊ณ .. ์คํ๋ง ๋ถํธ์ h2 ์ฐ๊ฒฐ์ ๋๋ฌด ๋ถ์ ํ ๊ฒ ๊ฐ์ต๋๋ค. JPA ๊ณต๋ถ์ค์ ์ ์ผ ์ด๋ ค์ด ๋ถ๋ถ์ด ์คํ๋ง ๋ถํธ์ h2 ์ฐ๊ฒฐ ๊ฐ์ต๋๋ค. ( ์ ๋ ์ํ๋์ ๋ชจ๋ JPA ๊ฐ์๋ฅผ ๋ค์๊ณ , ํญ์ ์ด๊ธฐ 2,3์ผ ์ฐ๊ฒฐ์ ์คํจํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ) ๋ค๋ฅธ ํ๊ฒฝ์ ์ถ์ฒ ํด ์ฃผ์๊ฑฐ๋, ๋ช ํํ ๋งค๋ด์ผ ๋ถํ๋๋ฆฝ๋๋ค.
- 0
- 4
- 912
Q&A
QHello Test ์์ ์ค๋ฅ ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค.
๊ฐ์ ๋ฌธ์๊ฐ ์ฌ๊ธฐ๋ ํ๋ฒ ์ฌ๋ผ ์จ ๊ฒ ๊ฐ์๋ฐ ํด๊ฒฐ๋์๋ ์ง์? https://www.inflearn.com/questions/701235/test%EC%98%A4%EB%A5%98
- 0
- 4
- 912
Q&A
QHello Test ์์ ์ค๋ฅ ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค.
์ถ๊ฐ ๋ ๊ฒ์ Hello class ๋ฅผ ๋ง๋ค์๊ณ , package study.querydsl.entity; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import lombok.Getter; import lombok.Setter; @Entity @Getter @Setter public class Hello { @Id @GeneratedValue private Long id ; } QHello ๊ฐ ๋ง๋ค์ด ์ก๊ณ , package study.querydsl.entity; 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; /** * QHello is a Querydsl query type for Hello */ @Generated("com.querydsl.codegen.DefaultEntitySerializer") public class QHello extends EntityPathBase { private static final long serialVersionUID = 1910216155L; public static final QHello hello = new QHello("hello"); public final NumberPath id = createNumber("id", Long.class); public QHello(String variable) { super(Hello.class, forVariable(variable)); } public QHello(Path path) { super(path.getType(), path.getMetadata()); } public QHello(PathMetadata metadata) { super(Hello.class, metadata); } }ํ ์คํธ ์ฝ๋๋ ์๋์ ๊ฐ์ต๋๋ค. package study.querydsl; import com.querydsl.jpa.impl.JPAQueryFactory; import jakarta.persistence.EntityManager; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Commit; import org.springframework.transaction.annotation.Transactional; import study.querydsl.entity.Hello; import study.querydsl.entity.QHello; import static org.assertj.core.api.Assertions.*; @SpringBootTest @Transactional @Commit class QuerydslApplicationTests { @Autowired EntityManager em; @Test void contextLoads() { Hello hello = new Hello(); em.persist(hello); JPAQueryFactory query = new JPAQueryFactory(em); QHello qHello = QHello.hello; Hello result = query.selectFrom(qHello).fetchOne(); assertThat(result).isEqualTo(hello); assertThat(result.getId()).isEqualTo(hello.getId()); } } ์ค๋ฅ ์ฝ๋๋ ์๋๊ฐ ํต์ฌ ๊ฐ์๋ฐ์. Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=study.querydsl.entity.Hello]Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=study.querydsl.entity.Hello]
- 0
- 4
- 912
Q&A
unit Test ๋ ์ฑ๊ณตํ๋ค๊ณ ๋์ต๋๋ค๋ง, h2 ์ฝ์์์ Hello table ์ด ์์ฑ๋์ง ์์์ต๋๋ค.
h2 ๋ฅผ 2.1.214 ๋ฒ์ ์ ์ ๊ฑฐ ํ๊ณ , 1.4.199 ๋ฒ์ ผ์ผ๋ก ๋ค์ด๊ทธ๋ ์ด๋ ํ์ฌ ์ฑ๊ณตํ์์ต๋๋ค. ์ง๋๋ฒ ๋ค๋ฅธ ์์ ์์๋ 1.4.199 ๋ ์คํจํ๊ณ , 2.1.214 ๋ง ์ฑ๊ณตํ์๋๋ฐ, ์ด๋ ต๋ค์.
- 0
- 3
- 878
Q&A
unit Test ๋ ์ฑ๊ณตํ๋ค๊ณ ๋์ต๋๋ค๋ง, h2 ์ฝ์์์ Hello table ์ด ์์ฑ๋์ง ์์์ต๋๋ค.
๋ค์ฌ ์ฐ๊ธฐ๋ฅผ ๊ฐ์ด ํ์ฌ ํ ์คํธ ํด ๋ณด์์ต๋๋ค. ์คํํด ๋ดค๋๋ฐ, h2 ๋ฅผ ๋๋ฉด ์ค๋ฅ๋ฅผ ๋ด๊ณ h2 ๋ฅผ ์ผฐ์ ๋ ์ค๋ฅ๋ฅผ ๋ด์ง ์๋ ๊ฒ์ผ๋ก ๋ด์ ์ ์ ์ฐ๊ฒฐํ ๊ฒ ๊ฐ์๋ฐ, ํ ์คํธ ์์์ ์ฐ๊ฒฐ๋ก๊ทธ๋ ์๋ค์. ์๋์ ๊ฐ์ด ๋์ค๊ณ h2 ์ฝ์์์๋ hello ํ ์ด๋ธ์ด ์ถ๊ฐ๋์ง ์์ต๋๋ค. 2023-05-07 19:21:57.872 INFO 17015 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...2023-05-07 19:21:57.946 INFO 17015 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.2023-05-07 19:21:58.006 INFO 17015 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]2023-05-07 19:21:58.067 INFO 17015 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.4.9.Final}2023-05-07 19:21:58.260 INFO 17015 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}2023-05-07 19:21:58.407 INFO 17015 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect2023-05-07 19:21:59.091 DEBUG 17015 --- [ main] org.hibernate.SQL : drop table hello if exists2023-05-07 19:21:59.095 DEBUG 17015 --- [ main] org.hibernate.SQL : drop table member if exists2023-05-07 19:21:59.096 DEBUG 17015 --- [ main] org.hibernate.SQL : drop table team if exists2023-05-07 19:21:59.097 DEBUG 17015 --- [ main] org.hibernate.SQL : drop sequence if exists hibernate_sequence2023-05-07 19:21:59.100 DEBUG 17015 --- [ main] org.hibernate.SQL : create sequence hibernate_sequence start with 1 increment by 12023-05-07 19:21:59.103 DEBUG 17015 --- [ main] org.hibernate.SQL : create table hello (id bigint not null, primary key (id))2023-05-07 19:21:59.105 DEBUG 17015 --- [ main] org.hibernate.SQL : create table member (member_id bigint not null, age integer not null, username varchar(255), team_id bigint, primary key (member_id))2023-05-07 19:21:59.107 DEBUG 17015 --- [ main] org.hibernate.SQL : create table team (team_id bigint not null, name varchar(255), primary key (team_id))2023-05-07 19:21:59.110 DEBUG 17015 --- [ main] org.hibernate.SQL : alter table member add constraint FKcjte2jn9pvo9ud2hyfgwcja0k foreign key (team_id) references team2023-05-07 19:21:59.115 INFO 17015 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]2023-05-07 19:21:59.121 INFO 17015 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'2023-05-07 19:21:59.349 WARN 17015 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning2023-05-07 19:21:59.547 INFO 17015 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'2023-05-07 19:21:59.806 INFO 17015 --- [ main] study.querydsl.QuerydslApplicationTests : Started QuerydslApplicationTests in 8.197 seconds (JVM running for 8.992)2023-05-07 19:21:59.891 INFO 17015 --- [ main] o.s.t.c.transaction.TransactionContext : Began transaction (1) for test context [DefaultTestContext@3e62d773 testClass = QuerydslApplicationTests, testInstance = study.querydsl.QuerydslApplicationTests@796fe2b5, testMethod = contextLoads@QuerydslApplicationTests, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4ef74c30 testClass = QuerydslApplicationTests, locations = '{}', classes = '{class study.querydsl.QuerydslApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@7dcf94f8, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@f5958c9, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@5bda8e08, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@3d285d7e], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@1031c1a0]; rollback [false]2023-05-07 19:21:59.978 DEBUG 17015 --- [ main] org.hibernate.SQL : call next value for hibernate_sequence2023-05-07 19:22:00.180 DEBUG 17015 --- [ main] org.hibernate.SQL : insert into hello (id) values (?)2023-05-07 19:22:00.185 DEBUG 17015 --- [ main] org.hibernate.SQL : select hello0_.id as id1_0_ from hello hello0_2023-05-07 19:22:00.246 INFO 17015 --- [ main] o.s.t.c.transaction.TransactionContext : Committed transaction for test: [DefaultTestContext@3e62d773 testClass = QuerydslApplicationTests, testInstance = study.querydsl.QuerydslApplicationTests@796fe2b5, testMethod = contextLoads@QuerydslApplicationTests, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4ef74c30 testClass = QuerydslApplicationTests, locations = '{}', classes = '{class study.querydsl.QuerydslApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@7dcf94f8, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@f5958c9, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@5bda8e08, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@3d285d7e], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]2023-05-07 19:22:00.255 INFO 17015 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'2023-05-07 19:22:00.255 INFO 17015 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'2023-05-07 19:22:00.256 INFO 17015 --- [extShutdownHook] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'2023-05-07 19:22:00.256 DEBUG 17015 --- [extShutdownHook] org.hibernate.SQL : drop table hello if exists2023-05-07 19:22:00.258 DEBUG 17015 --- [extShutdownHook] org.hibernate.SQL : drop table member if exists2023-05-07 19:22:00.260 DEBUG 17015 --- [extShutdownHook] org.hibernate.SQL : drop table team if exists2023-05-07 19:22:00.262 DEBUG 17015 --- [extShutdownHook] org.hibernate.SQL : drop sequence if exists hibernate_sequence2023-05-07 19:22:00.264 INFO 17015 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...2023-05-07 19:22:09.295 INFO 17015 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
- 0
- 3
- 878
Q&A
unit Test ๋ ์ฑ๊ณตํ๋ค๊ณ ๋์ต๋๋ค๋ง, h2 ์ฝ์์์ Hello table ์ด ์์ฑ๋์ง ์์์ต๋๋ค.
p6spy ๋ ์ ์ฉ ์๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
- 0
- 3
- 878
Q&A
distinct๋ฅผ ์ ์ฉํ์ง ์์์ ๋์ ๊ฒฐ๊ณผ ๊ด๋ จ
์ ๋ ์ค๋ณต๋์ง ์์ ๊ณ ๋ฏผํ๋๋ฐ, ์๋์ผ๋ก distinct ๊ฐ ์ถ๊ฐ ๋๋ ๊ฑฐ์๋ค์. ๊ณ ๋ฏผ ๋.
- 3
- 4
- 793
Q&A
๋น๋ ์ค๋ฅ ํ์ธ ์์ฒญ
๊ฐ์ ํ๋จ์ ๋ฐ๋์ 1.4.199 ๋ก ํ๋ผ๊ณ ํด์ ์ต์ ์ ๋ฐ์ง ์๊ณ ๊ทธ๊ฒ์ ๋ฐ์ ํด์ ๋ฐ์ํ ์ค๋ฅ์ธ ๊ฒ์ด๋ค์. H2 ๋ฐ์ดํฐ๋ฒ ์ด์ค ๊ฐ์์์ ๋ฐ๋์ 1.4.199 ๋ฐ์ผ๋ผ๊ณ ๋์ด ์๋ ๋์ด ์๋ ํ๋จ ๋ฌธ๊ตฌ ์ ๊ฑฐ ๋ถํ๋๋ฆฝ๋๋ค.
- 0
- 2
- 533




