org.hibernate.annotations.Table matchingTable = null;
if ( table != null && tableName.equals( table.appliesTo() ) ) {
matchingTable = table;
}
else {
Tables tables = annotatedClass.getAnnotation( Tables.class );
if ( tables != null ) {
for (org.hibernate.annotations.Table current : tables.value()) {
if ( tableName.equals( current.appliesTo() ) ) {
matchingTable = current;
break;
}
}