List of usage examples for org.hibernate.tuple.entity EntityMetamodel getCascadeStyles
public CascadeStyle[] getCascadeStyles()
From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpa21Provider.java
License:Apache License
@Override public boolean isOrphanRemoval(ManagedType<?> ownerType, String attributeName) { AbstractEntityPersister entityPersister = getEntityPersister(ownerType); if (entityPersister != null) { EntityMetamodel entityMetamodel = entityPersister.getEntityMetamodel(); Integer index = entityMetamodel.getPropertyIndexOrNull(attributeName); if (index != null) { try { return (boolean) HAS_ORPHAN_DELETE_METHOD.invoke(entityMetamodel.getCascadeStyles()[index]); } catch (Exception ex) { throw new RuntimeException( "Could not access orphan removal information. Please report your version of hibernate so we can provide support for it!", ex);/*from w w w. ja v a2 s . com*/ } } } return false; }
From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpa21Provider.java
License:Apache License
@Override public boolean isDeleteCascaded(ManagedType<?> ownerType, String attributeName) { AbstractEntityPersister entityPersister = getEntityPersister(ownerType); if (entityPersister != null) { EntityMetamodel entityMetamodel = entityPersister.getEntityMetamodel(); Integer index = entityMetamodel.getPropertyIndexOrNull(attributeName); if (index != null) { try { return (boolean) DO_CASCADE_METHOD.invoke(entityMetamodel.getCascadeStyles()[index], DELETE_CASCADE); } catch (Exception ex) { throw new RuntimeException( "Could not access orphan removal information. Please report your version of hibernate so we can provide support for it!", ex);// w w w . ja va2 s .com } } } return false; }
From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpaProvider.java
License:Apache License
@Override public boolean isOrphanRemoval(ManagedType<?> ownerType, String attributeName) { AbstractEntityPersister entityPersister = getEntityPersister(ownerType); if (entityPersister != null) { EntityMetamodel entityMetamodel = entityPersister.getEntityMetamodel(); Integer index = entityMetamodel.getPropertyIndexOrNull(attributeName); if (index != null) { return entityMetamodel.getCascadeStyles()[index].hasOrphanDelete(); }// ww w . jav a2s . co m } return false; }
From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpaProvider.java
License:Apache License
@Override public boolean isDeleteCascaded(ManagedType<?> ownerType, String attributeName) { AbstractEntityPersister entityPersister = getEntityPersister(ownerType); if (entityPersister != null) { EntityMetamodel entityMetamodel = entityPersister.getEntityMetamodel(); Integer index = entityMetamodel.getPropertyIndexOrNull(attributeName); if (index != null) { return entityMetamodel.getCascadeStyles()[index].doCascade(CascadingAction.DELETE); }/* w w w . j a v a2 s. co m*/ } return false; }