Hi All,
I am just starting out on EJB3/hibernate and am having trouble implementing a generic findChildren API.
What I'd like is an API that looks something like this
public List findChildren(SomeEntity parent, String childrenProperty)
I do realize, we can do parent.getChildren() but I want a more dynamic way to get children of a given entity.
For eg. Given the following schema,
PARENT
==========
PARENT_ID PK
CHILD
=======
CHILD_ID PK
CHILD_NAME
PARENT_ID FK
I should be able call
List childList = HibernateAPI.findChildren(parent, "children");
Any help is appreciated.
Thanks,
Sridhar.
|