public PersistentEntity getRootEntity() {
   if (isRoot() || getParentEntity() == null) {
     return this;
   }
   PersistentEntity parent = getParentEntity();
   while (!parent.isRoot()) {
     parent = parent.getParentEntity();
   }
   return parent;
 }
 public boolean isOwningEntity(PersistentEntity owner) {
   return domainClass.isOwningClass(owner.getJavaClass());
 }