I am looking to build a dynamic framework where and entity object is provided and I will not have any knowledge of current entity type.
What I am trying is, if there are any child associations exist with ManyToOne association and process them differently.
Please let me know is there any way i can find child association names which have ManyToOne relationship
example:
//Parent Class
public class Person
{
@OneToMany(cascade = CascadeType.PERSIST, mappedBy = "personName")
private List<FamilyName> familyNameList = null;
}
// Child Class
public class FamilyName
{
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
@JoinColumn(name = "PERSON_RID", referencedColumnName = "PERSONNAME_RID", nullable = false),
private PersonNameNonAggregates personName = null;
}
I will be given a method similar as below
private void processEntity(Class<T> persistentClass){
// find child associations of the given persistent class and process
}
Let me know is there any i can fetch child associations names