use of org.hibernate.boot.spi.MetadataImplementor in project hibernate-orm by hibernate.
the class ConfigurationTest method testSharedCacheModeDisable.
@Test
public void testSharedCacheModeDisable() {
MetadataImplementor metadata = buildMetadata(SharedCacheMode.DISABLE_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());
assertTrue(pc.isCached());
}
use of org.hibernate.boot.spi.MetadataImplementor 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.boot.spi.MetadataImplementor 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.boot.spi.MetadataImplementor in project hibernate-orm by hibernate.
the class EnumeratedSmokeTest method testEnumeratedTypeResolutions.
/**
* I personally have been unable to repeoduce the bug as reported in HHH-10402. This test
* is equivalent to what the reporters say happens, but these tests pass fine.
*/
@Test
@TestForIssue(jiraKey = "HHH-10402")
public void testEnumeratedTypeResolutions() {
final MetadataImplementor mappings = (MetadataImplementor) new MetadataSources(ssr).addAnnotatedClass(EntityWithEnumeratedAttributes.class).buildMetadata();
mappings.validate();
final PersistentClass entityBinding = mappings.getEntityBinding(EntityWithEnumeratedAttributes.class.getName());
validateEnumMapping(entityBinding.getProperty("notAnnotated"), EnumType.ORDINAL);
validateEnumMapping(entityBinding.getProperty("noEnumType"), EnumType.ORDINAL);
validateEnumMapping(entityBinding.getProperty("ordinalEnumType"), EnumType.ORDINAL);
validateEnumMapping(entityBinding.getProperty("stringEnumType"), EnumType.STRING);
}
use of org.hibernate.boot.spi.MetadataImplementor in project hibernate-orm by hibernate.
the class SchemaUpdateTask method execute.
/**
* Execute the task
*/
@Override
public void execute() throws BuildException {
log("Running Hibernate Core SchemaUpdate.");
log("This is an Ant task supporting only mapping files, if you want to use annotations see http://tools.hibernate.org.");
try {
final StandardServiceRegistryBuilder ssrBuilder = new StandardServiceRegistryBuilder();
configure(ssrBuilder);
final StandardServiceRegistry ssr = ssrBuilder.build();
final MetadataSources metadataSources = new MetadataSources(ssr);
configure(metadataSources);
final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder();
configure(metadataBuilder, ssr);
final MetadataImplementor metadata = (MetadataImplementor) metadataBuilder.build();
new SchemaUpdate().setOutputFile(outputFile.getPath()).setDelimiter(delimiter).setHaltOnError(haltOnError).execute(TargetTypeHelper.parseLegacyCommandLineOptions(!quiet, !text, outputFile.getPath()), metadata);
} catch (HibernateException e) {
throw new BuildException("Schema text failed: " + e.getMessage(), e);
} catch (FileNotFoundException e) {
throw new BuildException("File not found: " + e.getMessage(), e);
} catch (IOException e) {
throw new BuildException("IOException : " + e.getMessage(), e);
} catch (BuildException e) {
throw e;
} catch (Exception e) {
throw new BuildException(e);
}
}
Aggregations