Created
September 11, 2018 15:26
-
-
Save hugithordarson/923b84d28e00c0e79fc605021a47f59d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package x; | |
import org.apache.cayenne.map.DbEntity; | |
import org.apache.cayenne.map.DbJoin; | |
import org.apache.cayenne.map.DbRelationship; | |
import nb.NBCore; | |
public class ListRelationships { | |
public static void main( String[] args ) { | |
for( DbEntity dbEntity : NBCore.newContext().getEntityResolver().getDbEntities() ) { | |
for( DbRelationship dbRelationship : dbEntity.getRelationships() ) { | |
System.out.println( "--- " + dbRelationship.getSourceEntityName() + ":" + dbRelationship.getName() ); | |
for( DbJoin dbJoin : dbRelationship.getJoins() ) { | |
System.out.println( dbRelationship.getTargetEntityName() + ";" + dbJoin.getSourceName() + ";" + dbJoin.getTargetName() ); | |
} | |
System.out.println(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment