private static Iterable < String > getAssociationTables ( EntityClass entityClass ) { Iterable < Settable > association = filter ( entityClass . getElements ( ) , and ( or ( has ( ManyToMany . class ) , has ( ElementCollection . class ) ) , has ( JoinTable . class ) ) ) ; return transform ( association , new Function < Settable , String > ( ) { @ Override public String apply ( Settable input ) { JoinTable annotation = input . getAnnotation ( JoinTable . class ) ; return annotation . name ( ) ; } } ) ; }
This will find all ManyToMany and ElementCollection annotated tables .