0
我需要檢查,如果實體有一些特殊的註釋(@ElementCollection和@JoinColumn)比較JPA註釋
for(Annotation annotation : field.getAnnotations())
{
if (annotation.equals("@ElementCollection") || annotation.equals("@JoinColumn"))
//do something
}
}
但我怎麼能檢查是否有一個@JoinColumn如果是這樣呢? (一個@JoinColumn 「內側」 一@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;
感謝annotation
對象(例如getDeclaredMethods
)上