Search in sources :

Example 6 with EntityMetamodel

use of org.hibernate.tuple.entity.EntityMetamodel in project hibernate-orm by hibernate.

the class InheritedNaturalIdTest method testNaturalIdNullability.

@Test
@TestForIssue(jiraKey = "HHH-10360")
public void testNaturalIdNullability() {
    final EntityPersister persister = sessionFactory().getEntityPersister(User.class.getName());
    final EntityMetamodel entityMetamodel = persister.getEntityMetamodel();
    // nullability is not specified, so it should be nullable by annotations-specific default
    assertTrue(persister.getPropertyNullability()[entityMetamodel.getPropertyIndex("uid")]);
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) EntityMetamodel(org.hibernate.tuple.entity.EntityMetamodel) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 7 with EntityMetamodel

use of org.hibernate.tuple.entity.EntityMetamodel in project hibernate-orm by hibernate.

the class MutableNaturalIdTest method testNaturalIdNullability.

@Test
@TestForIssue(jiraKey = "HHH-10360")
public void testNaturalIdNullability() {
    final EntityPersister persister = sessionFactory().getEntityPersister(User.class.getName());
    final EntityMetamodel entityMetamodel = persister.getEntityMetamodel();
    // nullability is not specified, so it should be non-nullable by hbm-specific default
    assertFalse(persister.getPropertyNullability()[entityMetamodel.getPropertyIndex("name")]);
    assertFalse(persister.getPropertyNullability()[entityMetamodel.getPropertyIndex("org")]);
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) EntityMetamodel(org.hibernate.tuple.entity.EntityMetamodel) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Aggregations

EntityMetamodel (org.hibernate.tuple.entity.EntityMetamodel)7 EntityPersister (org.hibernate.persister.entity.EntityPersister)5 TestForIssue (org.hibernate.testing.TestForIssue)5 Test (org.junit.Test)5 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 Field (java.lang.reflect.Field)1 Session (org.hibernate.Session)1 ClassMetadata (org.hibernate.metadata.ClassMetadata)1 AbstractEntityPersister (org.hibernate.persister.entity.AbstractEntityPersister)1 IdentifierProperty (org.hibernate.tuple.IdentifierProperty)1 NonIdentifierAttribute (org.hibernate.tuple.NonIdentifierAttribute)1