public class EntityUtils extends Object
| Constructor and Description |
|---|
EntityUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getEntityTableName(Class entity,
boolean nameWithSchema)
Returns a entity table name.
|
static Object |
getId(Object object)
Method to return entity id (field/method with annotation @Id or
|
static Object |
getId(Object object,
Class clazz)
Method to return entity id (field/method with annotation @Id or
|
static AccessibleObject |
getIdAccessibleObject(Class clazz)
Return field/method with annotation @Id/@EmbeddedId from a entity class.
|
static String |
getIdFieldName(Class clazz)
Return the name of @Id/@EmbeddedId field/method from entity
|
static String |
getIdFieldName(Object object)
Return the name of @Id/@EmbeddedId field/method from entity
|
static Object |
getIdFromString(String id,
Class entityClass)
Convert a string to a mapped id type.
|
static Class |
getIdType(Class clazz)
Return the type of @Id/@EmbeddedId from entity.
|
static String |
getLowerFirstLetter(String string) |
static List<Class> |
getMappedEntities(javax.persistence.EntityManager entityManager)
Return mapped entities in EntityManager.
|
static Class |
getPersistentClass(Object object)
Return a class from object id object is null then return null, if object
instance of HibernateProxy then return
getHibernateLazyInitializer().getPersistentClass()
|
static boolean |
hasAutoGeneratedId(Class clazz)
Return true is @GeneratedValue is present in id
|
static boolean |
hasEmbeddedId(Class clazz)
Return true if @EmbeddedId is present in id
|
static boolean |
isEntity(Class clazz)
Returns true if the class has the annotation @Entity
|
static boolean |
isPersisted(Object object)
Returns true if entity has a not null @Id/ @EmbeddedId
|
public static Object getIdFromString(String id, Class entityClass)
@Id
private Integer id;
With string "10" returns a Integer value 10id - entityClass - public static String getEntityTableName(Class entity, boolean nameWithSchema)
entity - nameWithSchema - Indicate if name comes with schema. Example:
yourShema.tableNamepublic static List<Class> getMappedEntities(javax.persistence.EntityManager entityManager)
entityManager - public static boolean hasAutoGeneratedId(Class clazz)
clazz - public static boolean hasEmbeddedId(Class clazz)
clazz - public static Object getId(Object object)
object - public static boolean isPersisted(Object object)
object - public static Object getId(Object object, Class clazz)
object - clazz - current classpublic static Class getPersistentClass(Object object)
object - public static Class getIdType(Class clazz)
clazz - public static String getIdFieldName(Object object)
object - public static String getIdFieldName(Class clazz)
clazz - public static AccessibleObject getIdAccessibleObject(Class clazz)
clazz - public static boolean isEntity(Class clazz)
clazz - Copyright © 2015. All rights reserved.