mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
search supertypes for session getter in repository type
This commit is contained in:
parent
2cfe93cd88
commit
a541a64eec
@ -283,7 +283,7 @@ else if ( containsAnnotation( method, Constants.HQL, Constants.SQL, Constants.FI
|
||||
}
|
||||
}
|
||||
|
||||
findSessionGetter( methodsOfClass );
|
||||
findSessionGetter( element );
|
||||
|
||||
if ( managed ) {
|
||||
putMember( "class", new AnnotationMetaType(this) );
|
||||
@ -301,14 +301,27 @@ else if ( containsAnnotation( method, Constants.HQL, Constants.SQL, Constants.FI
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
private void findSessionGetter(List<ExecutableElement> methodsOfClass) {
|
||||
if ( !containsAnnotation( element, Constants.ENTITY ) ) {
|
||||
for ( ExecutableElement method : methodsOfClass ) {
|
||||
private void findSessionGetter(TypeElement type) {
|
||||
if ( !containsAnnotation( type, Constants.ENTITY ) ) {
|
||||
for ( ExecutableElement method : methodsIn( type.getEnclosedElements() ) ) {
|
||||
if ( isSessionGetter( method ) ) {
|
||||
dao = true;
|
||||
sessionType = addDaoConstructor( method );
|
||||
}
|
||||
}
|
||||
if ( !dao ) {
|
||||
final TypeMirror superclass = type.getSuperclass();
|
||||
if ( superclass.getKind() == TypeKind.DECLARED ) {
|
||||
final DeclaredType declaredType = (DeclaredType) superclass;
|
||||
findSessionGetter( (TypeElement) declaredType.asElement() );
|
||||
}
|
||||
for ( TypeMirror superinterface : type.getInterfaces() ) {
|
||||
if ( superinterface.getKind() == TypeKind.DECLARED ) {
|
||||
final DeclaredType declaredType = (DeclaredType) superinterface;
|
||||
findSessionGetter( (TypeElement) declaredType.asElement() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user