172만명의 커뮤니티!! 함께 토론해봐요.
해결됨
실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
안녕하세요 비즈니스 메서드에 관해 궁금한 게 생겨서 질문드립니다. 강의 중에 엔티티를 변경할 때는 Setter대신 비즈니스 메서드를 별도 작성하여 제공하라고 해주셨는데 1) 등록이나 수정(save, update) 같은 것을 할 때 domain 쪽에 비즈니스 메서드를 작성하라는 뜻이 맞나요? 2) 구글링을 해보니 빌더 패턴, 정적펙토리 메소드 라는 기술도 존재하던데 비즈니스 메서드를 포함한 3가지는 궁극적으로 하는일이 비슷하다고 생각하는데 다른가요?
spring-boot 웹앱 웹앱 spring java jpa JPA
gnstjrdlsla
2023-02-09T00:47:21.616Z
댓글 1
좋아요 0
조회수 747
미해결
[백문이불여일타] 데이터 분석을 위한 고급 SQL
Where p1.id > p2.id 조건을 delete하는 의미는 p1.id 3, p2.id 1 인 경우만 delete 되어야 하는데, p1.id 1, p2.id 3 / p1.id 3, p2.id 3 은 왜 delete가 되나요?
kingdex
2023-02-09T00:10:46.412Z
댓글 1
좋아요 0
조회수 293
해결됨
스프링 시큐리티 OAuth2
OAuth2AuthorizationService 구현체를 JdbcOAuth2AuthorizationService로 변경하였습니다. Spring Authorization Server 버전은 1.0 입니다. @Bean public OAuth2AuthorizationService authorizationService(JdbcTemplate jdbcTemplate, RegisteredClientRepository registeredClientRepository) { return new JdbcOAuth2AuthorizationService(jdbcTemplate, registeredClientRepository); } DB Schema : Spring Authorization Server 에서 제공 /* IMPORTANT: If using PostgreSQL, update ALL columns defined with 'blob' to 'text', as PostgreSQL does not support the 'blob' data type. */ CREATE TABLE oauth2_authorization ( id varchar(100) NOT NULL, registered_client_id varchar(100) NOT NULL, principal_name varchar(200) NOT NULL, authorization_grant_type varchar(100) NOT NULL, authorized_scopes varchar(1000) DEFAULT NULL, attributes blob DEFAULT NULL, state varchar(500) DEFAULT NULL, authorization_code_value blob DEFAULT NULL, authorization_code_issued_at timestamp DEFAULT NULL, authorization_code_expires_at timestamp DEFAULT NULL, authorization_code_metadata blob DEFAULT NULL, access_token_value blob DEFAULT NULL, access_token_issued_at timestamp DEFAULT NULL, access_token_expires_at timestamp DEFAULT NULL, access_token_metadata blob DEFAULT NULL, access_token_type varchar(100) DEFAULT NULL, access_token_scopes varchar(1000) DEFAULT NULL, oidc_id_token_value blob DEFAULT NULL, oidc_id_token_issued_at timestamp DEFAULT NULL, oidc_id_token_expires_at timestamp DEFAULT NULL, oidc_id_token_metadata blob DEFAULT NULL, refresh_token_value blob DEFAULT NULL, refresh_token_issued_at timestamp DEFAULT NULL, refresh_token_expires_at timestamp DEFAULT NULL, refresh_token_metadata blob DEFAULT NULL, PRIMARY KEY (id) ); authorization code 발급시 로그인 화면 계정 정보 입력 후 MariaDB에 저장할떄 .BadSqlGrammarException 예외가 발생합니다, 질문1)에러 로그를 보면 insertAuthorization 메소드에서 attribute 컬럼에 Principal Class 자체를 저장하는 과정에서 발생하고 있습니다, 다만, 퀴리를 DB에서 직접 실행하면 저장이 되는것 으로 보아 Spring JDBCTemplate에서 변환시 오루가 발생하는거 같은데 원인이 궁급합니다. private void insertAuthorization(OAuth2Authorization authorization) { List<SqlParameterValue> parameters = this.authorizationParametersMapper.apply(authorization); try (LobCreator lobCreator = this.lobHandler.getLobCreator()) { PreparedStatementSetter pss = new LobCreatorArgumentPreparedStatementSetter(lobCreator, parameters.toArray()); this.jdbcOperations.update(SAVE_AUTHORIZATION_SQL, pss); } } Caused by: java.sql.SQLSyntaxErrorException: (conn=952251) Could not convert [{"@class":"java.util.Collections$UnmodifiableMap"," java.security .Principal":{"@class":" org.springframework.security .authentication.UsernamePasswordAuthenticationToken","authorities":["java.util.Collections$UnmodifiableRandomAccessList",[{"@class":" org.springframework.security .core.authority.SimpleGrantedAuthority","authority":"ROLE_USER"}]],"details":{"@class":" org.springframework.security .web.authentication.WebAuthenticationDetails","remoteAddress":"0:0:0:0:0:0:0:1","sessionId":"B8C2C171954B719820D6592F6102AF9B"},"authenticated":true,"principal":{"@class":" org.springframework.security .core.userdetails.User","password":null,"username":"user1","authorities":["java.util.Collections$UnmodifiableSet",[{"@class":" org.springframework.security .core.authority.SimpleGrantedAuthority","authority":"ROLE_USER"}]],"accountNonExpired":true,"accountNonLocked":true,"credentialsNonExpired":true,"enabled":true},"credentials":null}," org.springframework.security .oauth2.core.endpoint.OAuth2AuthorizationRequest":{"@class":" org.springframework.security .oauth2.core.endpoint.OAuth2AuthorizationRequest","authorizationUri":" http://localhost:9000/oauth2/authorize","authorizationGrantType":{"value":"authorization_code"},"responseType":{"value":"code"},"clientId":"messaging-client","redirectUri":"http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc","scopes":["java.util.Collections$UnmodifiableSet",["openid"]],"state":null,"additionalParameters":{"@class":"java.util.Collections$UnmodifiableMap","grant_type":"authorization_code"},"authorizationRequestUri":"http://localhost:9000/oauth2/authorize?response_type=code&client_id=messaging-client&scope=openid&redirect_uri=http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc&grant_type=authorization_code","attributes":{"@class":"java.util.Collections$UnmodifiableMap"} }}] to -4 RegisteredClientRepository는 구현체를 JdbcRegisteredClientRepository 로 변경해도 이상없이 동작 하고 있고 JdbcAuthorizationConsentService는 JdbcOAuth2AuthorizationService 오류로 동의 단게가 진행되지 않아서 확인해보지 않았습니다. 질문2)이외에도Authorization Server에서 blob 컴럼에 Class 자체를 저장하는 사례가 많이 있는데 커스참 구현체를 만들어서 Class 를 저장하지 않고 Authorization Server 필요한 항목만 JSON 으로 저장 하거나 테이블을 정규화 하여 Map 에 담아 주는것이 좋은 방법일까요? 참고로 Attribe는 JwtGenerator에서 보면 nonce 을 가지고 오고 있습니다. if (AuthorizationGrantType.AUTHORIZATION_CODE.equals(context.getAuthorizationGrantType())) { OAuth2AuthorizationRequest authorizationRequest = context.getAuthorization().getAttribute( OAuth2AuthorizationRequest.class.getName()); String nonce = (String) authorizationRequest.getAdditionalParameters().get(OidcParameterNames.NONCE); if (StringUtils.hasText(nonce)) { claimsBuilder.claim(IdTokenClaimNames.NONCE, nonce); } } 에러로그 전문 org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO oauth2_authorization (id, registered_client_id, principal_name, authorization_grant_type, authorized_scopes, attributes, state, authorization_code_value, authorization_code_issued_at, authorization_code_expires_at,authorization_code_metadata,access_token_value,access_token_issued_at,access_token_expires_at,access_token_metadata,access_token_type,access_token_scopes,oidc_id_token_value,oidc_id_token_issued_at,oidc_id_token_expires_at,oidc_id_token_metadata,refresh_token_value,refresh_token_issued_at,refresh_token_expires_at,refresh_token_metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] at org.springframework.jdbc.support .SQLExceptionSubclassTranslator.doTranslate( SQLExceptionSubclassTranslator.java:101 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.support .AbstractFallbackSQLExceptionTranslator.translate( AbstractFallbackSQLExceptionTranslator.java:70 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.JdbcTemplate.translateException( JdbcTemplate.java:1538 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.JdbcTemplate.execute( JdbcTemplate.java:667 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:960 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:1015 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.security .oauth2.server.authorization.JdbcOAuth2AuthorizationService.insertAuthorization( JdbcOAuth2AuthorizationService.java:211 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService.save ( JdbcOAuth2AuthorizationService.java:189 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.security .oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationProvider.authenticate( OAuth2AuthorizationCodeRequestAuthenticationProvider.java:209 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.security .authentication.ProviderManager.authenticate( ProviderManager.java:182 ) ~[spring-security-core-6.0.1.jar:6.0.1] at org.springframework.security .oauth2.server.authorization.web.OAuth2AuthorizationEndpointFilter.doFilterInternal( OAuth2AuthorizationEndpointFilter.java:166 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .oauth2.server.authorization.web.OAuth2AuthorizationServerMetadataEndpointFilter.doFilterInternal( OAuth2AuthorizationServerMetadataEndpointFilter.java:84 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.authentication.logout.LogoutFilter.doFilter( LogoutFilter.java:107 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.authentication.logout.LogoutFilter.doFilter( LogoutFilter.java:93 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.csrf.CsrfFilter.doFilterInternal( CsrfFilter.java:116 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.header.HeaderWriterFilter.doHeadersAfter( HeaderWriterFilter.java:90 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.header.HeaderWriterFilter.doFilterInternal( HeaderWriterFilter.java:75 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .oauth2.server.authorization.config.annotation.web.configurers.AuthorizationServerContextFilter.doFilterInternal( AuthorizationServerContextFilter.java:61 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.context.SecurityContextHolderFilter.doFilter( SecurityContextHolderFilter.java:82 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.context.SecurityContextHolderFilter.doFilter( SecurityContextHolderFilter.java:69 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal( WebAsyncManagerIntegrationFilter.java:62 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.session.DisableEncodeUrlFilter.doFilterInternal( DisableEncodeUrlFilter.java:42 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.security .web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:374 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.FilterChainProxy.doFilterInternal( FilterChainProxy.java:233 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.security .web.FilterChainProxy.doFilter( FilterChainProxy.java:191 ) ~[spring-security-web-6.0.1.jar:6.0.1] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate( DelegatingFilterProxy.java:351 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter( DelegatingFilterProxy.java:267 ) ~[spring-web-6.0.4.jar:6.0.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:185 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:158 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.springframework.web.filter.RequestContextFilter.doFilterInternal( RequestContextFilter.java:100 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:185 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:158 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.springframework.web.filter.FormContentFilter.doFilterInternal( FormContentFilter.java:93 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:185 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:158 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal( CharacterEncodingFilter.java:201 ) ~[spring-web-6.0.4.jar:6.0.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:116 ) ~[spring-web-6.0.4.jar:6.0.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:185 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:158 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:177 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:97 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.authenticator.AuthenticatorBase.invoke( AuthenticatorBase.java:542 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:119 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.valves.ErrorReportValve.invoke( ErrorReportValve.java:92 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.core.StandardEngineValve.invoke( StandardEngineValve.java:78 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.catalina.connector.CoyoteAdapter.service( CoyoteAdapter.java:357 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.coyote.http11.Http11Processor.service( Http11Processor.java:400 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.coyote.AbstractProcessorLight.process( AbstractProcessorLight.java:65 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process( AbstractProtocol.java:859 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.tomcat.util.net .NioEndpoint$SocketProcessor.doRun( NioEndpoint.java:1734 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.tomcat.util.net.SocketProcessorBase.run ( SocketProcessorBase.java:52 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1191 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run( ThreadPoolExecutor.java:659 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run( TaskThread.java:61 ) ~[tomcat-embed-core-10.1.5.jar:10.1.5] at java.base/java.lang.Thread.run( Thread.java:833 ) ~[na:na] Caused by: java.sql.SQLSyntaxErrorException: (conn=952251) Could not convert [{"@class":"java.util.Collections$UnmodifiableMap"," java.security .Principal":{"@class":" org.springframework.security .authentication.UsernamePasswordAuthenticationToken","authorities":["java.util.Collections$UnmodifiableRandomAccessList",[{"@class":" org.springframework.security .core.authority.SimpleGrantedAuthority","authority":"ROLE_USER"}]],"details":{"@class":" org.springframework.security .web.authentication.WebAuthenticationDetails","remoteAddress":"0:0:0:0:0:0:0:1","sessionId":"B8C2C171954B719820D6592F6102AF9B"},"authenticated":true,"principal":{"@class":" org.springframework.security .core.userdetails.User","password":null,"username":"user1","authorities":["java.util.Collections$UnmodifiableSet",[{"@class":" org.springframework.security .core.authority.SimpleGrantedAuthority","authority":"ROLE_USER"}]],"accountNonExpired":true,"accountNonLocked":true,"credentialsNonExpired":true,"enabled":true},"credentials":null}," org.springframework.security .oauth2.core.endpoint.OAuth2AuthorizationRequest":{"@class":" org.springframework.security .oauth2.core.endpoint.OAuth2AuthorizationRequest","authorizationUri":" http://localhost:9000/oauth2/authorize","authorizationGrantType":{"value":"authorization_code"},"responseType":{"value":"code"},"clientId":"messaging-client","redirectUri":"http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc","scopes":["java.util.Collections$UnmodifiableSet",["openid"]],"state":null,"additionalParameters":{"@class":"java.util.Collections$UnmodifiableMap","grant_type":"authorization_code"},"authorizationRequestUri":"http://localhost:9000/oauth2/authorize?response_type=code&client_id=messaging-client&scope=openid&redirect_uri=http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc&grant_type=authorization_code","attributes":{"@class":"java.util.Collections$UnmodifiableMap"} }}] to -4 at org.mariadb.jdbc.export.ExceptionFactory.createException( ExceptionFactory.java:282 ) ~[mariadb-java-client-3.0.10.jar:na] at org.mariadb.jdbc.export.ExceptionFactory.create( ExceptionFactory.java:336 ) ~[mariadb-java-client-3.0.10.jar:na] at org.mariadb.jdbc.BasePreparedStatement.setInternalObject( BasePreparedStatement.java:1172 ) ~[mariadb-java-client-3.0.10.jar:na] at org.mariadb.jdbc.BasePreparedStatement.setObject( BasePreparedStatement.java:608 ) ~[mariadb-java-client-3.0.10.jar:na] at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setObject( HikariProxyPreparedStatement.java ) ~[HikariCP-5.0.1.jar:na] at org.springframework.jdbc.core.StatementCreatorUtils.setValue( StatementCreatorUtils.java:415 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal( StatementCreatorUtils.java:236 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue( StatementCreatorUtils.java:152 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.ArgumentPreparedStatementSetter.doSetValue( ArgumentPreparedStatementSetter.java:65 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.security .oauth2.server.authorization.JdbcOAuth2AuthorizationService$LobCreatorArgumentPreparedStatementSetter.doSetValue( JdbcOAuth2AuthorizationService.java:621 ) ~[spring-security-oauth2-authorization-server-1.0.0.jar:1.0.0] at org.springframework.jdbc.core.ArgumentPreparedStatementSetter.setValues( ArgumentPreparedStatementSetter.java:50 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.JdbcTemplate.lambda$update$2( JdbcTemplate.java:963 ) ~[spring-jdbc-6.0.4.jar:6.0.4] at org.springframework.jdbc.core.JdbcTemplate.execute( JdbcTemplate.java:651 ) ~[spring-jdbc-6.0.4.jar:6.0.4] ... 68 common frames omitted
java spring spring-boot spring-boot oauth
신석균
2023-02-08T07:17:18.647Z
댓글 1
좋아요 0
조회수 1455
미해결
데이터 분석 SQL Fundamentals
mysql workbench를 사용 중인데 여기에 데이터를 올려서 실습을 진행할 수 없는지가 궁금합니다! 할 수 있다면 어떻게 해야 하나요?
DBMS/RDBMS sql dbms/rdbms postgresql
서인범
2023-02-08T04:44:53.544Z
댓글 3
좋아요 0
조회수 686
해결됨
자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
안녕하세요. 질문이 있습니다, @Id @GeneratedValue(...) private Long id; 이렇게는 사용해봤는데 처음에 =null 을 사용하신 이유가 궁금합니다.
spring-boot java JPA mysql aws spring
조재연
2023-02-08T02:50:16.981Z
댓글 1
좋아요 1
조회수 864
해결됨
실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
우선 2개의 질문을 참고하였습니다. 이것과 이것입니다. 두개의 글을 종합해 보면, V1에서 Order리스트를 반환할때는 Lazy방식이기 때문에 Member객체가 프록시 객체이고, Jackson이 해당 해당 객체를 접근하는 순간 초기화한다는 것입니다. 그리고 해당 프록시 객체를 JSON으로 읽을수 있도록 도와주는 것이 하이버네이트5모듈이라는 것입니다. 여기서 궁금한 점이 //강제 지연 로딩 설정 hibernate5Module.configure(Hibernate5Module.Feature.FORCE_LAZY_LOADING, true); 이 코드입니다. 해당 코드는 강제 지연 로딩 설정이라고 하는데 강의 21분 20초경 LAZY를 강제 초기화 한다고 나와있습니다. 저는 위의 코드와 for (Order order : orders) { order.getMember().getName(); order.getDelivery().getAddress(); } 이 코드가 같은 역할을 한다고 이해했습니다. 위의 두개의 코드를 삭제하면, 포스트맨으로 요청을 보냈을 때, Member, orderItems, Delivery에는 null 값이 들어갑니다. 두개의 코드중 하나를 넣으면 요청을 넣었을때 Member, orderItems, Delivery에 실제 값이 들어가게 됩니다. 하지만 위의 두 글을 종합한 내용을 보면 Jackson이 해당 해당 객체를 접근하는 순간 초기화 라는 내용이 있습니다. 그렇다면 이미 초기화 된 프록시 객체일텐데 왜 위의 강제초기화 코드를 넣어야 실제 값이 들어가게 되는지 궁금합니다. jackson이 프록시 객체에 접근할때 초기화가 되어서 두 코드를 넣지 않아도 null이 아닌 실제 값이 나와야하는 것 아닌가요? 글이 너무 길어 죄송합니다..ㅠㅠ
JPA spring jpa java spring-boot
양지웅
2023-02-07T12:36:03.121Z
댓글 1
좋아요 2
조회수 799
미해결
자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
안녕하세요. 선생님 따라서 코딩중인데 구글링결과대로 시도해봐도 딱히 해결되지 않아서 질문 남겼습니다... 제목 그대로 import 자체가 되지 않아요 ㅠ
spring-boot JPA aws spring jpa mysql java
데브키맨
2023-02-07T11:45:14.696Z
댓글 2
좋아요 2
조회수 3635
미해결
자바 ORM 표준 JPA 프로그래밍 - 기본편
<요구사항> 사용자가 맘에 드는 장소를 저장 할 수 있다. Place 에서 FavoritePlace 를 Join 하고 싶다. <관계도> Place(1) - (N)FavoritePlace(N) - (1)User <질문내용> Place 에는 FavoritePlace 필드가 없기 때문에 join 을 사용 할 수 가 없어서 , 양방향 매핑을 이용 하였습니다. 이럴 경우 양방향 매핑을 사용하는것이 맞는지 궁금하고, FavoirtePlace 의 상태가 변경될때의,연관관계 편의메서드를 구현하였는데 흐름은 Place 가 가지고 있는 list 를 순회하여, 바뀌기전의 FavoirtePlace 를 삭제하고 새로운 FavoirtePlace 를 add 하는 로직을 선택하였습니다. 그러다보니 수많은 List 중 FavoirtePlace 하나를 순회하여 찾아 제거 하는 작업이 조금 버거울거같다는 고민이 생겼습니다. 제가 이해한 양방향을 써야 하는 상황이 이부분이 맞는지, 위와 같은 상황에서 어떻게 해결하는게 조금 더 현명할지 조언 듣고 싶습니다! 감사합니다
dlektl6
2023-02-07T11:31:47.495Z
댓글 3
좋아요 0
조회수 703
미해결
자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
BookMemoryRepository랑 BookMysqlRepository에 @Repository를 모두 붙이면 빨간줄이 강의상에선 나는데 저는 이상이 없는 데 혹시 스프링 버전 차이인건지 궁금합니다.
spring JPA java aws jpa mysql spring-boot
이진섭
2023-02-07T07:10:06.472Z
댓글 2
좋아요 1
조회수 656
미해결
[개념은 호옹~, 실습 빡] SQL 데이터 분석, 활용!
sql 섹션 5의 돈가스 판매금액,모두얼마나와요? 여기서 where 말고 and 를 쓰시는데 두개가 같은 의미를 가지고있는거 맞나요?
postgresql sql dbms/rdbms DBMS/RDBMS
hyqooooo
2023-02-07T05:57:39.188Z
댓글 1
좋아요 0
조회수 475
해결됨
자바 ORM 표준 JPA 프로그래밍 - 기본편
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] Joincolumn의 name속성은 그저 member테이블의 조인컬럼의 컬럼명을 지정하는것뿐 team과 매핑하는것과는 관련이없다. member와 team을 연관관계맺는것은 referencedColumnName속성이 하지만 이것을 생략하면 자동으로 team의 pk값으로 연관관계를 맺어줘서 생략한다. 이게 맞을까요?
기범
2023-02-06T15:51:18.924Z
댓글 1
좋아요 0
조회수 627
미해결
[리뉴얼] SQL 베이스캠프
[제품 이름이 'A'로 시작하면서 가격이 평균 이상인 제품을 구해주세요. 아래와 같이 작성하면 애러가 발생됩니다. 이유를 설명하고, 코드를 작성하세요.] 2회차 자료 마지막 문제인데 답이 뭔가요?
김현정
2023-02-06T15:01:31.434Z
댓글 0
좋아요 0
조회수 424
미해결
데이터 분석 SQL Fundamentals
date_part 나 justify_inteval, age 함수의 postgresql에서만 되는 걸로 확인이 됩니다. 같이 공부하고 있지만 저는 실제로 oracle을 사용하고 있기 때문에 오라클에서도 오늘날짜 - 입사 날짜를 하였을 때 근속년수가 xx년 x월 이렇게 나오게 하고 싶은데 extract(year from sysdate) - extract(year from hiredate)||'년' 으로 하면 년도만 나오는 방법만 생각이 나서요. 혹시 방법이 있다면 알려주시면 감사하겠습니다.
postgresql sql dbms/rdbms DBMS/RDBMS
tkddbs7279
2023-02-06T09:12:41.804Z
댓글 1
좋아요 0
조회수 340
미해결
자바 개발자를 위한 코틀린 입문(Java to Kotlin Starter Guide)
안녕하세요, 주제와는 좀 다른 질문인데요. 강의하시는거 보면 맥에서 intelij 를 상당히 잘 활용하신다고 느꼈습니다. 특히, 9강에서 ide 화면을 4분할로 빠르게 구성하는게 인상적이었는데, 혹시 그 방법과 단축키 알려주실수 있나요?
밗성배
2023-02-06T06:09:45.175Z
댓글 1
좋아요 1
조회수 642
미해결
스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
따라치기에 바쁘고 코드를 적으시는데 이해못하면 잘못 듣고있는건가요? 자바 강의는 다 들었는데 뭘하시는지를 모르겠고 따라적기만 하고있습니다..
spring spring-boot mvc java MVC
송민석
2023-02-05T09:48:03.269Z
댓글 1
좋아요 0
조회수 287
미해결
[개념은 호옹~, 실습 빡] SQL 데이터 분석, 입문!
DISTINCT 함수(거래처 목록, 중복 없이 뽑아주세요) 이 강의에서 과제를 내주셨잖아요? 거래내역의 입금 총액은? 이렇게요 . --거래내역의 총합 SELECT sum(amount) as total FROM transactions; 이걸 말씀하시는건지.. 아니면 제가 문제를 이해를 못하는건가요 ... 혹시 답을 적어주실수있나요 선생님의 과제 의도를 이해하고싶어서요
sql dbms/rdbms DBMS/RDBMS postgresql
hyqooooo
2023-02-05T07:19:28.208Z
댓글 1
좋아요 0
조회수 1265
해결됨
스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
해당 에러를 고치기 위해 세팅의 자바 컴파일러 버전을 11로 바꾸었는데 이렇게 진행하여도 괜찮은가요??
spring-boot mvc MVC spring java
정현주
2023-02-04T17:36:54.420Z
댓글 1
좋아요 0
조회수 559
미해결
자바 ORM 표준 JPA 프로그래밍 - 기본편
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Cannot drop "PRODUCT" because "FKR3MKF1FYVW50W5N52XQ1B8A4B" depends on it; SQL statement: 참조때문에 drop이 안되어서 create를 다시할떄 문제가 생기는 것같습니다.
kim1234123
2023-02-04T05:28:01.629Z
댓글 1
좋아요 1
조회수 489
미해결
JSP 웹 쇼핑몰 프로그래밍 기본 과정(JSP WEB Programming)
강사님 새해 인사 조금 늦졌지만 건강하세요 강사님의 지식을 뛰어난 전달력으로 강의 해주셔서 고맙습니다..
kangjee212
2023-02-04T03:48:05.605Z
댓글 1
좋아요 0
조회수 551
해결됨
나도코딩의 자바 기본편 - 풀코스 (20시간)
강의 잘 듣고 있습니다! 이것저것 해보다가 궁금한게 생겼어요. 19번째 줄이 실행되는 순간 customerList의 fee 값이 바뀌어야 하는거 아닌가요? 20번째 줄을 안쓸때는 아래처럼 fee값이 안바뀐채로 출력되는데 챈 50 0 레 45 0 모 40 0 벤 20 0 제 10 0 20번째 줄을 쓰니까 이렇게 나오는 이유가 궁금합니다! 챈 50 2000 레 45 2000 모 40 2000 벤 20 0 제 10 0
2023-02-03T15:09:03.817Z
댓글 1
좋아요 0
조회수 295