use of org.hibernate.mapping.PersistentClass in project hibernate-orm by hibernate.
the class ConfigurationTest method testSharedCacheModeUnspecified.
@Test
public void testSharedCacheModeUnspecified() {
MetadataImplementor metadata = buildMetadata(SharedCacheMode.UNSPECIFIED);
PersistentClass pc = metadata.getEntityBinding(ExplicitlyCacheableEntity.class.getName());
assertFalse(pc.isCached());
pc = metadata.getEntityBinding(ExplicitlyNonCacheableEntity.class.getName());
assertFalse(pc.isCached());
pc = metadata.getEntityBinding(NoCacheableAnnotationEntity.class.getName());
assertFalse(pc.isCached());
}
use of org.hibernate.mapping.PersistentClass in project hibernate-orm by hibernate.
the class ConfigurationTest method testSharedCacheModeEnable.
@Test
public void testSharedCacheModeEnable() {
MetadataImplementor metadata = buildMetadata(SharedCacheMode.ENABLE_SELECTIVE);
PersistentClass pc = metadata.getEntityBinding(ExplicitlyCacheableEntity.class.getName());
assertTrue(pc.isCached());
pc = metadata.getEntityBinding(ExplicitlyNonCacheableEntity.class.getName());
assertFalse(pc.isCached());
pc = metadata.getEntityBinding(NoCacheableAnnotationEntity.class.getName());
assertFalse(pc.isCached());
}
use of org.hibernate.mapping.PersistentClass in project hibernate-orm by hibernate.
the class SimpleXmlOverriddenTest method baseline.
/**
* A baseline test, with an explicit @Convert annotation that should be in effect
*/
@Test
public void baseline() {
Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(TheEntity.class).buildMetadata();
PersistentClass pc = metadata.getEntityBinding(TheEntity.class.getName());
Type type = pc.getProperty("it").getType();
AttributeConverterTypeAdapter adapter = assertTyping(AttributeConverterTypeAdapter.class, type);
assertTrue(SillyStringConverter.class.isAssignableFrom(adapter.getAttributeConverter().getConverterJavaTypeDescriptor().getJavaType()));
}
use of org.hibernate.mapping.PersistentClass in project hibernate-orm by hibernate.
the class SimpleXmlOverriddenTest method testDefinitionAtAttributeLevel.
/**
* Test outcome of applying overrides via orm.xml, specifically at the attribute level
*/
@Test
public void testDefinitionAtAttributeLevel() {
// NOTE : simple-override.xml applied disable-conversion="true" at the attribute-level
Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(TheEntity.class).addResource("org/hibernate/test/converter/simple-override.xml").buildMetadata();
PersistentClass pc = metadata.getEntityBinding(TheEntity.class.getName());
Type type = pc.getProperty("it").getType();
assertTyping(StringType.class, type);
}
use of org.hibernate.mapping.PersistentClass in project hibernate-orm by hibernate.
the class ParameterizedAttributeConverterParameterTypeTest method testNestedTypeParameterAutoApplication.
@Test
@TestForIssue(jiraKey = "HHH-10050")
public void testNestedTypeParameterAutoApplication() {
final Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(SampleEntity.class).getMetadataBuilder().applyAttributeConverter(IntegerListConverter.class).applyAttributeConverter(StringListConverter.class).build();
// lets make sure the auto-apply converters were applied properly...
PersistentClass pc = metadata.getEntityBinding(SampleEntity.class.getName());
{
Property prop = pc.getProperty("someStrings");
AttributeConverterTypeAdapter type = assertTyping(AttributeConverterTypeAdapter.class, prop.getType());
assertTrue(StringListConverter.class.isAssignableFrom(type.getAttributeConverter().getConverterJavaTypeDescriptor().getJavaType()));
}
{
Property prop = pc.getProperty("someIntegers");
AttributeConverterTypeAdapter type = assertTyping(AttributeConverterTypeAdapter.class, prop.getType());
assertTrue(IntegerListConverter.class.isAssignableFrom(type.getAttributeConverter().getConverterJavaTypeDescriptor().getJavaType()));
}
}
Aggregations