detect use of custom SQL with @DynamicInsert/@DynamicUpdate
and produce nice error
This commit is contained in:
parent
2a2fea5d7b
commit
39cd03d1a5
|
@ -1225,6 +1225,14 @@ public class EntityBinder {
|
|||
persistentClass.setDynamicInsert( dynamicInsertAnn != null && dynamicInsertAnn.value() );
|
||||
final DynamicUpdate dynamicUpdateAnn = annotatedClass.getAnnotation( DynamicUpdate.class );
|
||||
persistentClass.setDynamicUpdate( dynamicUpdateAnn != null && dynamicUpdateAnn.value() );
|
||||
|
||||
if ( persistentClass.useDynamicInsert() && annotatedClass.isAnnotationPresent( SQLInsert.class ) ) {
|
||||
throw new AnnotationException( "Entity '" + name + "' is annotated both '@DynamicInsert' and '@SQLInsert'" );
|
||||
}
|
||||
if ( persistentClass.useDynamicUpdate() && annotatedClass.isAnnotationPresent( SQLUpdate.class ) ) {
|
||||
throw new AnnotationException( "Entity '" + name + "' is annotated both '@DynamicUpdate' and '@SQLUpdate'" );
|
||||
}
|
||||
|
||||
final SelectBeforeUpdate selectBeforeUpdateAnn = annotatedClass.getAnnotation( SelectBeforeUpdate.class );
|
||||
persistentClass.setSelectBeforeUpdate( selectBeforeUpdateAnn != null && selectBeforeUpdateAnn.value() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue