Skip to content

Commit 8cf0495

Browse files
committed
HHH-20028 - WIP - add missing callbacks
1 parent e59547c commit 8cf0495

19 files changed

+3789
-39
lines changed

hibernate-core/src/main/java/org/hibernate/boot/models/JpaAnnotations.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
import jakarta.persistence.NamedNativeStatements;
1414
import jakarta.persistence.NamedStatement;
1515
import jakarta.persistence.NamedStatements;
16+
import jakarta.persistence.PostDelete;
17+
import jakarta.persistence.PostInsert;
18+
import jakarta.persistence.PostUpsert;
19+
import jakarta.persistence.PreDelete;
20+
import jakarta.persistence.PreInsert;
21+
import jakarta.persistence.PreMerge;
22+
import jakarta.persistence.PreUpsert;
1623
import org.hibernate.boot.models.annotations.internal.AccessJpaAnnotation;
1724
import org.hibernate.boot.models.annotations.internal.AssociationOverrideJpaAnnotation;
1825
import org.hibernate.boot.models.annotations.internal.AssociationOverridesJpaAnnotation;
@@ -82,13 +89,20 @@
8289
import org.hibernate.boot.models.annotations.internal.OneToOneJpaAnnotation;
8390
import org.hibernate.boot.models.annotations.internal.OrderByJpaAnnotation;
8491
import org.hibernate.boot.models.annotations.internal.OrderColumnJpaAnnotation;
92+
import org.hibernate.boot.models.annotations.internal.PostDeleteJpaAnnotation;
93+
import org.hibernate.boot.models.annotations.internal.PostInsertJpaAnnotation;
8594
import org.hibernate.boot.models.annotations.internal.PostLoadJpaAnnotation;
8695
import org.hibernate.boot.models.annotations.internal.PostPersistJpaAnnotation;
8796
import org.hibernate.boot.models.annotations.internal.PostRemoveJpaAnnotation;
8897
import org.hibernate.boot.models.annotations.internal.PostUpdateJpaAnnotation;
98+
import org.hibernate.boot.models.annotations.internal.PostUpsertJpaAnnotation;
99+
import org.hibernate.boot.models.annotations.internal.PreDeleteJpaAnnotation;
100+
import org.hibernate.boot.models.annotations.internal.PreInsertJpaAnnotation;
101+
import org.hibernate.boot.models.annotations.internal.PreMergeJpaAnnotation;
89102
import org.hibernate.boot.models.annotations.internal.PrePersistJpaAnnotation;
90103
import org.hibernate.boot.models.annotations.internal.PreRemoveJpaAnnotation;
91104
import org.hibernate.boot.models.annotations.internal.PreUpdateJpaAnnotation;
105+
import org.hibernate.boot.models.annotations.internal.PreUpsertJpaAnnotation;
92106
import org.hibernate.boot.models.annotations.internal.PrimaryKeyJoinColumnJpaAnnotation;
93107
import org.hibernate.boot.models.annotations.internal.PrimaryKeyJoinColumnsJpaAnnotation;
94108
import org.hibernate.boot.models.annotations.internal.QueryHintJpaAnnotation;
@@ -684,13 +698,27 @@ public interface JpaAnnotations {
684698
false
685699
);
686700

701+
OrmAnnotationDescriptor<PostDelete,PostDeleteJpaAnnotation> POST_DELETE = new OrmAnnotationDescriptor<>(
702+
PostDelete.class,
703+
PostDeleteJpaAnnotation.class,
704+
EnumSet.of( Kind.METHOD ),
705+
false
706+
);
707+
687708
OrmAnnotationDescriptor<PostLoad,PostLoadJpaAnnotation> POST_LOAD = new OrmAnnotationDescriptor<>(
688709
PostLoad.class,
689710
PostLoadJpaAnnotation.class,
690711
EnumSet.of( Kind.METHOD ),
691712
false
692713
);
693714

715+
OrmAnnotationDescriptor<PostInsert,PostInsertJpaAnnotation> POST_INSERT = new OrmAnnotationDescriptor<>(
716+
PostInsert.class,
717+
PostInsertJpaAnnotation.class,
718+
EnumSet.of( Kind.METHOD ),
719+
false
720+
);
721+
694722
OrmAnnotationDescriptor<PostPersist,PostPersistJpaAnnotation> POST_PERSIST = new OrmAnnotationDescriptor<>(
695723
PostPersist.class,
696724
PostPersistJpaAnnotation.class,
@@ -712,6 +740,34 @@ public interface JpaAnnotations {
712740
false
713741
);
714742

743+
OrmAnnotationDescriptor<PostUpsert,PostUpsertJpaAnnotation> POST_UPSERT = new OrmAnnotationDescriptor<>(
744+
PostUpsert.class,
745+
PostUpsertJpaAnnotation.class,
746+
EnumSet.of( Kind.METHOD ),
747+
false
748+
);
749+
750+
OrmAnnotationDescriptor<PreDelete,PreDeleteJpaAnnotation> PRE_DELETE = new OrmAnnotationDescriptor<>(
751+
PreDelete.class,
752+
PreDeleteJpaAnnotation.class,
753+
EnumSet.of( Kind.METHOD ),
754+
false
755+
);
756+
757+
OrmAnnotationDescriptor<PreMerge,PreMergeJpaAnnotation> PRE_MERGE = new OrmAnnotationDescriptor<>(
758+
PreMerge.class,
759+
PreMergeJpaAnnotation.class,
760+
EnumSet.of( Kind.METHOD ),
761+
false
762+
);
763+
764+
OrmAnnotationDescriptor<PreInsert,PreInsertJpaAnnotation> PRE_INSERT = new OrmAnnotationDescriptor<>(
765+
PreInsert.class,
766+
PreInsertJpaAnnotation.class,
767+
EnumSet.of( Kind.METHOD ),
768+
false
769+
);
770+
715771
OrmAnnotationDescriptor<PrePersist,PrePersistJpaAnnotation> PRE_PERSIST = new OrmAnnotationDescriptor<>(
716772
PrePersist.class,
717773
PrePersistJpaAnnotation.class,
@@ -733,6 +789,13 @@ public interface JpaAnnotations {
733789
false
734790
);
735791

792+
OrmAnnotationDescriptor<PreUpsert,PreUpsertJpaAnnotation> PRE_UPSERT = new OrmAnnotationDescriptor<>(
793+
PreUpsert.class,
794+
PreUpsertJpaAnnotation.class,
795+
EnumSet.of( Kind.METHOD ),
796+
false
797+
);
798+
736799
OrmAnnotationDescriptor<PrimaryKeyJoinColumns,PrimaryKeyJoinColumnsJpaAnnotation> PRIMARY_KEY_JOIN_COLUMNS = new OrmAnnotationDescriptor<>(
737800
PrimaryKeyJoinColumns.class,
738801
PrimaryKeyJoinColumnsJpaAnnotation.class,
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PostDelete;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PostDeleteJpaAnnotation implements PostDelete {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PostDeleteJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PostDeleteJpaAnnotation(PostDelete annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PostDeleteJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PostDelete.class;
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PostInsert;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PostInsertJpaAnnotation implements PostInsert {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PostInsertJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PostInsertJpaAnnotation(PostInsert annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PostInsertJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PostInsert.class;
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PostUpsert;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PostUpsertJpaAnnotation implements PostUpsert {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PostUpsertJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PostUpsertJpaAnnotation(PostUpsert annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PostUpsertJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PostUpsert.class;
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PreDelete;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PreDeleteJpaAnnotation implements PreDelete {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PreDeleteJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PreDeleteJpaAnnotation(PreDelete annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PreDeleteJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PreDelete.class;
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PreInsert;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PreInsertJpaAnnotation implements PreInsert {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PreInsertJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PreInsertJpaAnnotation(PreInsert annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PreInsertJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PreInsert.class;
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PreMerge;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PreMergeJpaAnnotation implements PreMerge {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PreMergeJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PreMergeJpaAnnotation(PreMerge annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PreMergeJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PreMerge.class;
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.boot.models.annotations.internal;
6+
7+
import jakarta.persistence.PreUpsert;
8+
import org.hibernate.models.spi.ModelsContext;
9+
10+
import java.lang.annotation.Annotation;
11+
import java.util.Map;
12+
13+
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
14+
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
15+
public class PreUpsertJpaAnnotation implements PreUpsert {
16+
17+
/**
18+
* Used in creating dynamic annotation instances (e.g. from XML)
19+
*/
20+
public PreUpsertJpaAnnotation(ModelsContext modelContext) {
21+
}
22+
23+
/**
24+
* Used in creating annotation instances from JDK variant
25+
*/
26+
public PreUpsertJpaAnnotation(PreUpsert annotation, ModelsContext modelContext) {
27+
}
28+
29+
/**
30+
* Used in creating annotation instances from Jandex variant
31+
*/
32+
public PreUpsertJpaAnnotation(Map<String, Object> attributeValues, ModelsContext modelContext) {
33+
}
34+
35+
@Override
36+
public Class<? extends Annotation> annotationType() {
37+
return PreUpsert.class;
38+
}
39+
}

0 commit comments

Comments
 (0)