java - Comparing JPA annotations -
java - Comparing JPA annotations -
i need check if entity has specific annotations (@elementcollection , @joincolumn)
for(annotation annotation : field.getannotations()) { if (annotation.equals("@elementcollection") || annotation.equals("@joincolumn"))      //do } }    but how can check if there @joincolumn if it's this? (a @joincolumn "inside" @collectiontable)
@elementcollection @collectiontable(name = "alarm_plan_ids", joincolumns = {         @joincolumn(name = "alarm_id", referencedcolumnname = "inst_id"),         @joincolumn(name = "alarm_id_ak", referencedcolumnname = "inst_id_ak") }) protected set<instanceid> allplanidsinexistence;    thanks
use reflection on annotation object (e.g getdeclaredmethods). reveal getters sub-objects. can whatever need.
 java jpa annotations 
 
Comments
Post a Comment