add @DialectOverride.SQLSelect
This commit is contained in:
parent
adffa890b1
commit
559c325759
|
@ -362,6 +362,30 @@ public interface DialectOverride {
|
|||
FilterDefs[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specializes a {@link org.hibernate.annotations.SQLSelect}
|
||||
* in a certain dialect.
|
||||
*/
|
||||
@Target({METHOD, FIELD, TYPE})
|
||||
@Retention(RUNTIME)
|
||||
@Repeatable(SQLSelects.class)
|
||||
@OverridesAnnotation(org.hibernate.annotations.SQLSelect.class)
|
||||
@interface SQLSelect {
|
||||
/**
|
||||
* The {@link Dialect} in which this override applies.
|
||||
*/
|
||||
Class<? extends Dialect> dialect();
|
||||
Version before() default @Version(major = MAX_VALUE);
|
||||
Version sameOrAfter() default @Version(major = MIN_VALUE);
|
||||
|
||||
org.hibernate.annotations.SQLSelect override();
|
||||
}
|
||||
@Target({METHOD, FIELD})
|
||||
@Retention(RUNTIME)
|
||||
@interface SQLSelects {
|
||||
SQLSelect[] value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks an annotation type as a dialect-specific override for
|
||||
* some other annotation type.
|
||||
|
|
|
@ -51,6 +51,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
* </ol>
|
||||
*
|
||||
* @see HQLSelect
|
||||
* @see DialectOverride.SQLSelect
|
||||
*
|
||||
* @author Gavin King
|
||||
*
|
||||
|
|
|
@ -1251,8 +1251,9 @@ public class EntityBinder {
|
|||
}
|
||||
|
||||
private void bindCustomSql() {
|
||||
//SQL overriding
|
||||
//TODO: tolerate non-empty table() member here if it explicitly names the main table
|
||||
//TODO: would be nice to add these guys to @DialectOverride, but getOverridableAnnotation()
|
||||
// does not yet handle repeatable annotations
|
||||
|
||||
final SQLInsert sqlInsert = findMatchingSqlAnnotation( "", SQLInsert.class, SQLInserts.class );
|
||||
if ( sqlInsert != null ) {
|
||||
|
@ -1288,7 +1289,7 @@ public class EntityBinder {
|
|||
+ persistentClass.getEntityName());
|
||||
}
|
||||
|
||||
final SQLSelect sqlSelect = annotatedClass.getAnnotation( SQLSelect.class );
|
||||
final SQLSelect sqlSelect = getOverridableAnnotation( annotatedClass, SQLSelect.class, context );
|
||||
if ( sqlSelect != null ) {
|
||||
final String loaderName = persistentClass.getEntityName() + "$SQLSelect";
|
||||
persistentClass.setLoaderName( loaderName );
|
||||
|
|
Loading…
Reference in New Issue