HHH-17999 use Constructor<Expectation> instead of Class<Expectation>
for Quarkus Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
97a15ae194
commit
abbfa5333e
|
@ -180,6 +180,7 @@ import static org.hibernate.boot.model.internal.PropertyHolderBuilder.buildPrope
|
|||
import static org.hibernate.boot.model.internal.BinderHelper.extractFromPackage;
|
||||
import static org.hibernate.boot.model.source.internal.hbm.ModelBinder.useEntityWhereClauseForCollections;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.fromResultCheckStyle;
|
||||
import static org.hibernate.internal.util.ReflectHelper.getDefaultConstructor;
|
||||
import static org.hibernate.internal.util.StringHelper.getNonEmptyOrConjunctionIfBothNonEmpty;
|
||||
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
||||
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||
|
@ -1336,7 +1337,7 @@ public abstract class CollectionBinder {
|
|||
fromResultCheckStyle( sqlInsert.check() )
|
||||
);
|
||||
if ( sqlInsert.verify() != Expectation.class ) {
|
||||
collection.setInsertExpectation( sqlInsert.verify() );
|
||||
collection.setInsertExpectation( getDefaultConstructor( sqlInsert.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1348,7 +1349,7 @@ public abstract class CollectionBinder {
|
|||
fromResultCheckStyle( sqlUpdate.check() )
|
||||
);
|
||||
if ( sqlUpdate.verify() != Expectation.class ) {
|
||||
collection.setUpdateExpectation( sqlUpdate.verify() );
|
||||
collection.setUpdateExpectation( getDefaultConstructor( sqlUpdate.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1360,7 +1361,7 @@ public abstract class CollectionBinder {
|
|||
fromResultCheckStyle( sqlDelete.check() )
|
||||
);
|
||||
if ( sqlDelete.verify() != Expectation.class ) {
|
||||
collection.setDeleteExpectation( sqlDelete.verify() );
|
||||
collection.setDeleteExpectation( getDefaultConstructor( sqlDelete.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1372,7 +1373,7 @@ public abstract class CollectionBinder {
|
|||
fromResultCheckStyle( sqlDeleteAll.check() )
|
||||
);
|
||||
if ( sqlDeleteAll.verify() != Expectation.class ) {
|
||||
collection.setDeleteAllExpectation( sqlDeleteAll.verify() );
|
||||
collection.setDeleteAllExpectation( getDefaultConstructor( sqlDeleteAll.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ import static org.hibernate.boot.model.internal.TableBinder.bindForeignKey;
|
|||
import static org.hibernate.boot.model.naming.Identifier.toIdentifier;
|
||||
import static org.hibernate.engine.OptimisticLockStyle.fromLockType;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.fromResultCheckStyle;
|
||||
import static org.hibernate.internal.util.ReflectHelper.getDefaultConstructor;
|
||||
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
||||
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||
import static org.hibernate.internal.util.StringHelper.nullIfEmpty;
|
||||
|
@ -1396,7 +1397,7 @@ public class EntityBinder {
|
|||
fromResultCheckStyle( sqlInsert.check() )
|
||||
);
|
||||
if ( sqlInsert.verify() != Expectation.class ) {
|
||||
persistentClass.setInsertExpectation( sqlInsert.verify() );
|
||||
persistentClass.setInsertExpectation( getDefaultConstructor( sqlInsert.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1412,7 @@ public class EntityBinder {
|
|||
fromResultCheckStyle( sqlUpdate.check() )
|
||||
);
|
||||
if ( sqlUpdate.verify() != Expectation.class ) {
|
||||
persistentClass.setUpdateExpectation( sqlUpdate.verify() );
|
||||
persistentClass.setUpdateExpectation( getDefaultConstructor( sqlUpdate.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1426,7 +1427,7 @@ public class EntityBinder {
|
|||
fromResultCheckStyle( sqlDelete.check() )
|
||||
);
|
||||
if ( sqlDelete.verify() != Expectation.class ) {
|
||||
persistentClass.setDeleteExpectation( sqlDelete.verify() );
|
||||
persistentClass.setDeleteExpectation( getDefaultConstructor( sqlDelete.verify() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2273,7 +2274,7 @@ public class EntityBinder {
|
|||
fromResultCheckStyle( sqlInsert.check() )
|
||||
);
|
||||
if ( sqlInsert.verify() != Expectation.class ) {
|
||||
join.setInsertExpectation( sqlInsert.verify() );
|
||||
join.setInsertExpectation( getDefaultConstructor( sqlInsert.verify() ) );
|
||||
}
|
||||
}
|
||||
else if ( matchingTable != null ) {
|
||||
|
@ -2296,7 +2297,7 @@ public class EntityBinder {
|
|||
fromResultCheckStyle( sqlUpdate.check() )
|
||||
);
|
||||
if ( sqlUpdate.verify() != Expectation.class ) {
|
||||
join.setUpdateExpectation( sqlUpdate.verify() );
|
||||
join.setUpdateExpectation( getDefaultConstructor( sqlUpdate.verify() ) );
|
||||
}
|
||||
}
|
||||
else if ( matchingTable != null ) {
|
||||
|
@ -2319,7 +2320,7 @@ public class EntityBinder {
|
|||
fromResultCheckStyle( sqlDelete.check() )
|
||||
);
|
||||
if ( sqlDelete.verify() != Expectation.class ) {
|
||||
join.setDeleteExpectation( sqlDelete.verify() );
|
||||
join.setDeleteExpectation( getDefaultConstructor( sqlDelete.verify() ) );
|
||||
}
|
||||
}
|
||||
else if ( matchingTable != null ) {
|
||||
|
|
|
@ -12,6 +12,8 @@ import org.hibernate.annotations.ResultCheckStyle;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.hibernate.jdbc.Expectation;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
/**
|
||||
* For persistence operations (INSERT, UPDATE, DELETE) what style of
|
||||
* determining results (success/failure) is to be used.
|
||||
|
@ -90,12 +92,17 @@ public enum ExecuteUpdateResultCheckStyle {
|
|||
return customSql != null && callable ? PARAM : COUNT;
|
||||
}
|
||||
|
||||
public static @Nullable Class<? extends Expectation> expectationClass(@Nullable ExecuteUpdateResultCheckStyle style) {
|
||||
if ( style == null ) {
|
||||
return null;
|
||||
public static @Nullable Constructor<? extends Expectation> expectationConstructor(
|
||||
@Nullable ExecuteUpdateResultCheckStyle style) {
|
||||
return style == null ? null : style.expectationConstructor();
|
||||
}
|
||||
|
||||
public Constructor<? extends Expectation> expectationConstructor() {
|
||||
try {
|
||||
return expectationClass().getDeclaredConstructor();
|
||||
}
|
||||
else {
|
||||
return style.expectationClass();
|
||||
catch ( NoSuchMethodException e ) {
|
||||
throw new AssertionFailure("Could not instantiate Expectation", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.jdbc;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
|
@ -41,21 +42,29 @@ public class Expectations {
|
|||
* @since 6.5
|
||||
*/
|
||||
@Internal
|
||||
public static Expectation createExpectation(Class<? extends Expectation> expectation, boolean callable) {
|
||||
if ( expectation == null ) {
|
||||
expectation = callable ? Expectation.OutParameter.class : Expectation.RowCount.class;
|
||||
}
|
||||
final Expectation instance;
|
||||
try {
|
||||
instance = expectation.newInstance();
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
throw new InstantiationException( "Could not instantiate Expectation", expectation, e );
|
||||
}
|
||||
instance.validate(callable);
|
||||
public static Expectation createExpectation(Constructor<? extends Expectation> expectation, boolean callable) {
|
||||
final Expectation instance = instantiate( expectation, callable );
|
||||
instance.validate( callable );
|
||||
return instance;
|
||||
}
|
||||
|
||||
private static Expectation instantiate(Constructor<? extends Expectation> constructor, boolean callable) {
|
||||
if ( constructor == null ) {
|
||||
return callable
|
||||
? new Expectation.OutParameter()
|
||||
: new Expectation.RowCount();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
return constructor.newInstance();
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
throw new InstantiationException( "Could not instantiate Expectation",
|
||||
constructor.getDeclaringClass(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static CallableStatement toCallableStatement(PreparedStatement statement) {
|
||||
if ( statement instanceof CallableStatement ) {
|
||||
return (CallableStatement) statement;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
@ -37,7 +38,7 @@ import org.hibernate.type.Type;
|
|||
import org.hibernate.usertype.UserCollectionType;
|
||||
|
||||
import static org.hibernate.internal.util.collections.ArrayHelper.EMPTY_BOOLEAN_ARRAY;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.expectationClass;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.expectationConstructor;
|
||||
|
||||
/**
|
||||
* A mapping model object representing a collection. Subclasses specialize to particular kinds of collection.
|
||||
|
@ -107,10 +108,10 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
|||
|
||||
private String loaderName;
|
||||
|
||||
private Class<? extends Expectation> insertExpectation;
|
||||
private Class<? extends Expectation> updateExpectation;
|
||||
private Class<? extends Expectation> deleteExpectation;
|
||||
private Class<? extends Expectation> deleteAllExpectation;
|
||||
private Constructor<? extends Expectation> insertExpectation;
|
||||
private Constructor<? extends Expectation> updateExpectation;
|
||||
private Constructor<? extends Expectation> deleteExpectation;
|
||||
private Constructor<? extends Expectation> deleteAllExpectation;
|
||||
|
||||
/**
|
||||
* hbm.xml binding
|
||||
|
@ -593,7 +594,7 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
|||
this.customSQLInsert = customSQLInsert;
|
||||
this.customInsertCallable = callable;
|
||||
this.insertCheckStyle = checkStyle;
|
||||
this.insertExpectation = expectationClass( checkStyle );
|
||||
this.insertExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLInsert() {
|
||||
|
@ -616,7 +617,7 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
|||
this.customSQLUpdate = customSQLUpdate;
|
||||
this.customUpdateCallable = callable;
|
||||
this.updateCheckStyle = checkStyle;
|
||||
this.updateExpectation = expectationClass( checkStyle );
|
||||
this.updateExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLUpdate() {
|
||||
|
@ -639,7 +640,7 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
|||
this.customSQLDelete = customSQLDelete;
|
||||
this.customDeleteCallable = callable;
|
||||
this.deleteCheckStyle = checkStyle;
|
||||
this.deleteExpectation = expectationClass( checkStyle );
|
||||
this.deleteExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLDelete() {
|
||||
|
@ -665,7 +666,7 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
|||
this.customSQLDeleteAll = customSQLDeleteAll;
|
||||
this.customDeleteAllCallable = callable;
|
||||
this.deleteAllCheckStyle = checkStyle;
|
||||
this.deleteAllExpectation = expectationClass( checkStyle );
|
||||
this.deleteAllExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLDeleteAll() {
|
||||
|
@ -876,35 +877,35 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
|||
return softDeleteColumn;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getInsertExpectation() {
|
||||
public Constructor<? extends Expectation> getInsertExpectation() {
|
||||
return insertExpectation;
|
||||
}
|
||||
|
||||
public void setInsertExpectation(Class<? extends Expectation> insertExpectation) {
|
||||
public void setInsertExpectation(Constructor<? extends Expectation> insertExpectation) {
|
||||
this.insertExpectation = insertExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getUpdateExpectation() {
|
||||
public Constructor<? extends Expectation> getUpdateExpectation() {
|
||||
return updateExpectation;
|
||||
}
|
||||
|
||||
public void setUpdateExpectation(Class<? extends Expectation> updateExpectation) {
|
||||
public void setUpdateExpectation(Constructor<? extends Expectation> updateExpectation) {
|
||||
this.updateExpectation = updateExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getDeleteExpectation() {
|
||||
public Constructor<? extends Expectation> getDeleteExpectation() {
|
||||
return deleteExpectation;
|
||||
}
|
||||
|
||||
public void setDeleteExpectation(Class<? extends Expectation> deleteExpectation) {
|
||||
public void setDeleteExpectation(Constructor<? extends Expectation> deleteExpectation) {
|
||||
this.deleteExpectation = deleteExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getDeleteAllExpectation() {
|
||||
public Constructor<? extends Expectation> getDeleteAllExpectation() {
|
||||
return deleteAllExpectation;
|
||||
}
|
||||
|
||||
public void setDeleteAllExpectation(Class<? extends Expectation> deleteAllExpectation) {
|
||||
public void setDeleteAllExpectation(Constructor<? extends Expectation> deleteAllExpectation) {
|
||||
this.deleteAllExpectation = deleteAllExpectation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -15,7 +16,7 @@ import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
|||
import org.hibernate.jdbc.Expectation;
|
||||
import org.hibernate.sql.Alias;
|
||||
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.expectationClass;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.expectationConstructor;
|
||||
|
||||
/**
|
||||
* A mapping model object representing some sort of auxiliary table, for
|
||||
|
@ -50,9 +51,9 @@ public class Join implements AttributeContainer, Serializable {
|
|||
private boolean customDeleteCallable;
|
||||
private ExecuteUpdateResultCheckStyle deleteCheckStyle;
|
||||
|
||||
private Class<? extends Expectation> insertExpectation;
|
||||
private Class<? extends Expectation> updateExpectation;
|
||||
private Class<? extends Expectation> deleteExpectation;
|
||||
private Constructor<? extends Expectation> insertExpectation;
|
||||
private Constructor<? extends Expectation> updateExpectation;
|
||||
private Constructor<? extends Expectation> deleteExpectation;
|
||||
|
||||
@Override
|
||||
public void addProperty(Property property) {
|
||||
|
@ -140,7 +141,7 @@ public class Join implements AttributeContainer, Serializable {
|
|||
this.customSQLInsert = customSQLInsert;
|
||||
this.customInsertCallable = callable;
|
||||
this.insertCheckStyle = checkStyle;
|
||||
this.insertExpectation = expectationClass( checkStyle );
|
||||
this.insertExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLInsert() {
|
||||
|
@ -163,7 +164,7 @@ public class Join implements AttributeContainer, Serializable {
|
|||
this.customSQLUpdate = customSQLUpdate;
|
||||
this.customUpdateCallable = callable;
|
||||
this.updateCheckStyle = checkStyle;
|
||||
this.updateExpectation = expectationClass( checkStyle );
|
||||
this.updateExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLUpdate() {
|
||||
|
@ -186,7 +187,7 @@ public class Join implements AttributeContainer, Serializable {
|
|||
this.customSQLDelete = customSQLDelete;
|
||||
this.customDeleteCallable = callable;
|
||||
this.deleteCheckStyle = checkStyle;
|
||||
this.deleteExpectation = expectationClass( checkStyle );
|
||||
this.deleteExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLDelete() {
|
||||
|
@ -234,27 +235,27 @@ public class Join implements AttributeContainer, Serializable {
|
|||
this.optional = nullable;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getInsertExpectation() {
|
||||
public Constructor<? extends Expectation> getInsertExpectation() {
|
||||
return insertExpectation;
|
||||
}
|
||||
|
||||
public void setInsertExpectation(Class<? extends Expectation> insertExpectation) {
|
||||
public void setInsertExpectation(Constructor<? extends Expectation> insertExpectation) {
|
||||
this.insertExpectation = insertExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getUpdateExpectation() {
|
||||
public Constructor<? extends Expectation> getUpdateExpectation() {
|
||||
return updateExpectation;
|
||||
}
|
||||
|
||||
public void setUpdateExpectation(Class<? extends Expectation> updateExpectation) {
|
||||
public void setUpdateExpectation(Constructor<? extends Expectation> updateExpectation) {
|
||||
this.updateExpectation = updateExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getDeleteExpectation() {
|
||||
public Constructor<? extends Expectation> getDeleteExpectation() {
|
||||
return deleteExpectation;
|
||||
}
|
||||
|
||||
public void setDeleteExpectation(Class<? extends Expectation> deleteExpectation) {
|
||||
public void setDeleteExpectation(Constructor<? extends Expectation> deleteExpectation) {
|
||||
this.deleteExpectation = deleteExpectation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
@ -43,7 +44,7 @@ import static java.util.Collections.unmodifiableList;
|
|||
import static java.util.Comparator.comparing;
|
||||
import static org.hibernate.internal.util.StringHelper.qualify;
|
||||
import static org.hibernate.internal.util.StringHelper.root;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.expectationClass;
|
||||
import static org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle.expectationConstructor;
|
||||
import static org.hibernate.mapping.MappingHelper.checkPropertyColumnDuplication;
|
||||
import static org.hibernate.sql.Template.collectColumnNames;
|
||||
|
||||
|
@ -121,9 +122,9 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
|||
private Component declaredIdentifierMapper;
|
||||
private OptimisticLockStyle optimisticLockStyle;
|
||||
|
||||
private Class<? extends Expectation> insertExpectation;
|
||||
private Class<? extends Expectation> updateExpectation;
|
||||
private Class<? extends Expectation> deleteExpectation;
|
||||
private Constructor<? extends Expectation> insertExpectation;
|
||||
private Constructor<? extends Expectation> updateExpectation;
|
||||
private Constructor<? extends Expectation> deleteExpectation;
|
||||
|
||||
private boolean isCached;
|
||||
private CacheLayout queryCacheLayout;
|
||||
|
@ -802,7 +803,7 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
|||
this.customSQLInsert = customSQLInsert;
|
||||
this.customInsertCallable = callable;
|
||||
this.insertCheckStyle = checkStyle;
|
||||
this.insertExpectation = expectationClass( checkStyle );
|
||||
this.insertExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLInsert() {
|
||||
|
@ -825,7 +826,7 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
|||
this.customSQLUpdate = customSQLUpdate;
|
||||
this.customUpdateCallable = callable;
|
||||
this.updateCheckStyle = checkStyle;
|
||||
this.updateExpectation = expectationClass( checkStyle );
|
||||
this.updateExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLUpdate() {
|
||||
|
@ -848,7 +849,7 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
|||
this.customSQLDelete = customSQLDelete;
|
||||
this.customDeleteCallable = callable;
|
||||
this.deleteCheckStyle = checkStyle;
|
||||
this.deleteExpectation = expectationClass( checkStyle );
|
||||
this.deleteExpectation = expectationConstructor( checkStyle );
|
||||
}
|
||||
|
||||
public String getCustomSQLDelete() {
|
||||
|
@ -1262,27 +1263,27 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
|||
return null;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getInsertExpectation() {
|
||||
public Constructor<? extends Expectation> getInsertExpectation() {
|
||||
return insertExpectation;
|
||||
}
|
||||
|
||||
public void setInsertExpectation(Class<? extends Expectation> insertExpectation) {
|
||||
public void setInsertExpectation(Constructor<? extends Expectation> insertExpectation) {
|
||||
this.insertExpectation = insertExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getUpdateExpectation() {
|
||||
public Constructor<? extends Expectation> getUpdateExpectation() {
|
||||
return updateExpectation;
|
||||
}
|
||||
|
||||
public void setUpdateExpectation(Class<? extends Expectation> updateExpectation) {
|
||||
public void setUpdateExpectation(Constructor<? extends Expectation> updateExpectation) {
|
||||
this.updateExpectation = updateExpectation;
|
||||
}
|
||||
|
||||
public Class<? extends Expectation> getDeleteExpectation() {
|
||||
public Constructor<? extends Expectation> getDeleteExpectation() {
|
||||
return deleteExpectation;
|
||||
}
|
||||
|
||||
public void setDeleteExpectation(Class<? extends Expectation> deleteExpectation) {
|
||||
public void setDeleteExpectation(Constructor<? extends Expectation> deleteExpectation) {
|
||||
this.deleteExpectation = deleteExpectation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,14 @@ public @interface NoResultCheck {
|
|||
class Binder implements TypeBinder<NoResultCheck> {
|
||||
@Override
|
||||
public void bind(NoResultCheck annotation, MetadataBuildingContext buildingContext, PersistentClass persistentClass) {
|
||||
persistentClass.setInsertExpectation(Expectation.None.class);
|
||||
persistentClass.setUpdateExpectation(Expectation.None.class);
|
||||
persistentClass.setDeleteExpectation(Expectation.None.class);
|
||||
try {
|
||||
persistentClass.setInsertExpectation(Expectation.None.class.getDeclaredConstructor());
|
||||
persistentClass.setUpdateExpectation(Expectation.None.class.getDeclaredConstructor());
|
||||
persistentClass.setDeleteExpectation(Expectation.None.class.getDeclaredConstructor());
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue