Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[버그] 수험번호 부여 오류 #176

Open
jyj1289 opened this issue Feb 21, 2025 · 0 comments · May be fixed by #177
Open

[버그] 수험번호 부여 오류 #176

jyj1289 opened this issue Feb 21, 2025 · 0 comments · May be fixed by #177
Assignees
Labels
버그 버그 발생

Comments

@jyj1289
Copy link
Member

jyj1289 commented Feb 21, 2025

🐞설명

AttributeConverter를 사용하여 수험번호(examinationNumber)를 암호화 및 복호화하고 있습니다. 그러나 @query 어노테이션을 사용할 때, 수험번호가 암호화된 상태로 쿼리에서 처리되기 때문에, between 함수가 적용되지 않습니다. 이로 인해 전형별로 원서를 하나 제출한 상태에서 다시 다른 원서를 제출할 때, 동일한 수험번호가 부여되어 PK가 충돌하는 문제가 발생합니다.

⛰️ 맥락

  1. 전형별로 원서를 제출한다.
  2. 새로 로그인하여 다시 원서를 제출한다.
  3. PK가 충돌하여 원서 작성이 되지 않으며 500 코드가 발생한다.

🌏 환경

OS: macOS

📄 로그

Detail: Key (examination_number)=(Wrel40wkS08=) already exists.
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [uk_34sdsp4bux2e7j1vy1ahqf3qh]
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:269)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:232)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:550)
	at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
	at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)

🙋🏻 덧붙일 말

No response

@jyj1289 jyj1289 added the 버그 버그 발생 label Feb 21, 2025
@jyj1289 jyj1289 self-assigned this Feb 21, 2025
jyj1289 added a commit that referenced this issue Feb 24, 2025
- @query 어노테이션을 사용하면 암호화에 대응할 수 없기때문에, FormRepository에 있던 findMaxExaminationNumber를 삭제했어요.
- FormRepositoryCustom 과 FormRepositoryImpl 에 findAllExaminationNumber 메서드를 작성했어요.
- AssignExaminationNumberService 에서 getNextExaminationNumber 메서드 로직을 변경했어요.
jyj1289 added a commit that referenced this issue Feb 24, 2025
- 호출하던 메서드 이름을 변경하였어요.
@jyj1289 jyj1289 linked a pull request Feb 24, 2025 that will close this issue
4 tasks
@jyj1289 jyj1289 linked a pull request Feb 24, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
버그 버그 발생
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant