Register reflection hints for JPA persistence callbacks

Closes gh-29348
This commit is contained in:
Sébastien Deleuze
2022-10-18 22:51:39 +02:00
parent d4fac82d68
commit e0129a3631
3 changed files with 29 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.PreRemove;
@Entity
@IdClass(EmployeeId.class)
@@ -59,4 +60,8 @@ public class Employee {
public void setLocation(EmployeeLocation location) {
this.location = location;
}
@PreRemove
public void preRemove() {
}
}

View File

@@ -91,6 +91,8 @@ class PersistenceManagedTypesBeanRegistrationAotProcessorTests {
.accepts(hints);
assertThat(RuntimeHintsPredicates.reflection().onType(Employee.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS)).accepts(hints);
assertThat(RuntimeHintsPredicates.reflection().onMethod(Employee.class, "preRemove"))
.accepts(hints);
assertThat(RuntimeHintsPredicates.reflection().onType(EmployeeId.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS)).accepts(hints);
assertThat(RuntimeHintsPredicates.reflection().onType(EmployeeLocationConverter.class)