#1149 - Refactor move PersistenceContextUtil into ... io.ebeaninternal

This commit is contained in:
rob bygrave
2017-10-04 21:12:39 +13:00
parent f85fa772bf
commit 5a5cb7ffbd
3 changed files with 2 additions and 3 deletions
@@ -0,0 +1,21 @@
package io.ebeaninternal.server.deploy;
import javax.persistence.Entity;
/**
* Utility to find the root bean type.
*/
public class PersistenceContextUtil {
/**
* Find and return the root bean type for the given class.
*/
public static Class<?> root(Class<?> beanType) {
Class<?> parent = beanType.getSuperclass();
while (parent != null && parent.isAnnotationPresent(Entity.class)) {
beanType = parent;
parent = parent.getSuperclass();
}
return beanType;
}
}