# 가드가 식별자를 찾는 방식 49: public boolean usesIdentityGeneration(Class> entityType) { 50: return identifierField(entityType) 51: .map(field -> field.getAnnotation(GeneratedValue.class)) 52: .filter(Objects::nonNull) 53: .map(generated -> generated.strategy() == GenerationType.IDENTITY) 54: .orElse(false); 55: } 56: 57: /** 58: * Finds the {@code @Id} field, walking superclasses. 59: * 60: *
Superclasses are walked because a mapped superclass carrying the identifier is the common
61: * shape; stopping at the declared class would silently classify every such entity as "not
62: * identity" and let the guard pass on exactly the entities it was written for.
63: */
64: private static Optional This is the measurement behind {@code HibernateBatchConfigurationGuard}. The guard refuses an
adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/hibernate/batch/HibernateBatchConfigurationGuardTest.java:14: private final HibernateBatchConfigurationGuard guard = new HibernateBatchConfigurationGuard();
adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/hibernate/batch/HibernateBatchConfigurationGuard.java:23:public final class HibernateBatchConfigurationGuard {
adapter/outbound/persistence-jpa/src/testkit/java/dev/caskeleton/adapter/outbound/persistence/testkit/id/IdentityEntity.java:16: * HibernateBatchConfigurationGuard} uses the same fact to refuse a batch profile that targets it.
# 그 타입을 인스턴스화하는 main 코드: 0
# 같은 패키지의 프로파일 레지스트리를 읽는 main 코드: 0
# 계획 문서가 이 과제의 산출물로 적은 것
2937:- Produces: Named batch profiles and startup diagnostics for IDENTITY and sequence mismatch.
# 가드가 거절하려는 전략이 main 에 나타나는 곳
adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/hibernate/batch/HibernateBatchConfigurationGuard.java:13: * The case that matters is {@link GenerationType#IDENTITY}. An identity column's value is
adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/hibernate/batch/HibernateBatchConfigurationGuard.java:42: + " uses GenerationType.IDENTITY, and IDENTITY disables insert batching: Hibernate"
adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/hibernate/batch/HibernateBatchConfigurationGuard.java:53: .map(generated -> generated.strategy() == GenerationType.IDENTITY)
# main 에서 @GeneratedValue 를 쓰는 줄: 0
# 출하 엔티티의 식별자 접근 방식
# main 의 @Entity 파일: 32
# 그중 @Id 를 필드에 단 파일: 27
# @Id 바로 뒤가 메서드 선언인 것 (프로퍼티 접근): 0
# @Access 나 AccessType 을 쓰는 줄 (저장소 전체): 0
# @EmbeddedId 를 쓰는 main 파일: LiveEventEntity.java