本文整理了Java中org.hibernate.cfg.Configuration.buildMapping()
方法的一些代码示例,展示了Configuration.buildMapping()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.buildMapping()
方法的具体详情如下:
包路径:org.hibernate.cfg.Configuration
类名称:Configuration
方法名:buildMapping
暂无
代码示例来源:origin: com.vecna/dbDiff-hibernate
/**
* Create a new converted instance
* @param catalogSchema default catalog/schema information
* @param configuration hibernate configuration (the mapping will be built from the configuration)
*/
public HibernateMappingsConverter(CatalogSchema catalogSchema, Configuration configuration) {
this(catalogSchema, configuration, configuration.buildMapping());
}
代码示例来源:origin: Blazebit/blaze-persistence
serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(configuration.getTableMappings(), sessionFactory.getDialect(), new SimpleTableNameFormatter(), configuration.buildMapping()));
代码示例来源:origin: com.blazebit/blaze-persistence-integration-hibernate-4.3
@Override
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
Class<?> valuesEntity;
boolean registerValuesEntity = true;
try {
valuesEntity = Class.forName("com.blazebit.persistence.impl.function.entity.ValuesEntity");
} catch (ClassNotFoundException e) {
throw new RuntimeException("Are you missing blaze-persistence-core-impl on the classpath?", e);
}
Iterator<PersistentClass> iter = configuration.getClassMappings();
while (iter.hasNext()) {
PersistentClass clazz = iter.next();
Class<?> entityClass = clazz.getMappedClass();
if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) {
clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName());
}
}
if (registerValuesEntity) {
// Register values entity if wasn't found
configuration.addAnnotatedClass(valuesEntity);
configuration.buildMappings();
PersistentClass clazz = configuration.getClassMapping(valuesEntity.getName());
clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName());
}
serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver());
serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(configuration.getTableMappings(), sessionFactory.getDialect(), new SimpleTableNameFormatter(), configuration.buildMapping()));
}
代码示例来源:origin: hibernate/hibernate
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
this.mapping = buildMapping();
xmlHelper = new XMLHelper();
}
代码示例来源:origin: Blazebit/blaze-persistence
@Override
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
Class<?> valuesEntity;
boolean registerValuesEntity = true;
try {
valuesEntity = Class.forName("com.blazebit.persistence.impl.function.entity.ValuesEntity");
} catch (ClassNotFoundException e) {
throw new RuntimeException("Are you missing blaze-persistence-core-impl on the classpath?", e);
}
Iterator<PersistentClass> iter = configuration.getClassMappings();
while (iter.hasNext()) {
PersistentClass clazz = iter.next();
Class<?> entityClass = clazz.getMappedClass();
if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) {
clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName());
}
}
if (registerValuesEntity) {
// Register values entity if wasn't found
configuration.addAnnotatedClass(valuesEntity);
configuration.buildMappings();
PersistentClass clazz = configuration.getClassMapping(valuesEntity.getName());
clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName());
}
serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver());
serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(configuration.getTableMappings(), sessionFactory.getDialect(), new SimpleTableNameFormatter(), configuration.buildMapping()));
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
//we need reflectionManager before reading the other components (MetadataSourceQueue in particular)
final MetadataProvider metadataProvider = (MetadataProvider) ois.readObject();
this.mapping = buildMapping();
xmlHelper = new XMLHelper();
createReflectionManager(metadataProvider);
ois.defaultReadObject();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
//we need reflectionManager before reading the other components (MetadataSourceQueue in particular)
final MetadataProvider metadataProvider = (MetadataProvider) ois.readObject();
this.mapping = buildMapping();
xmlHelper = new XMLHelper();
createReflectionManager(metadataProvider);
ois.defaultReadObject();
}
代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl
private String sqlCreateString(Table table) {
return table
.sqlCreateString(getDialect(), configuration.buildMapping(), getDefaultCatalog(), getDefaultSchema());
}
代码示例来源:origin: Jasig/uPortal
final Mapping mapping = this.configuration.buildMapping();
final String defaultCatalog =
this.configuration.getProperty(Environment.DEFAULT_CATALOG);
代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl
throws SQLException {
Dialect dialect = getDialect();
Mapping mapping = configuration.buildMapping();
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
private transient Mapping mapping = buildMapping();
代码示例来源:origin: org.beangle.commons/beangle-commons-orm
public String validateSchema(Configuration config, Dialect dialect, DatabaseMetadata databaseMetadata) {
String defaultCatalog = sessionFactoryBean.getHibernateProperties().getProperty(
Environment.DEFAULT_CATALOG);
String defaultSchema = sessionFactoryBean.getHibernateProperties()
.getProperty(Environment.DEFAULT_SCHEMA);
Mapping mapping = config.buildMapping();
Iterator<?> iter = config.getTableMappings();
while (iter.hasNext()) {
Table table = (Table) iter.next();
if (table.isPhysicalTable()) {
TableMetadata tableInfo = databaseMetadata.getTableMetadata(table.getName(),
(table.getSchema() == null) ? defaultSchema : table.getSchema(),
(table.getCatalog() == null) ? defaultCatalog : table.getCatalog(), table.isQuoted());
if (tableInfo == null) {
reporter.append("Missing table: " + table.getName() + "\n");
} else {
validateColumns(table, dialect, mapping, tableInfo);
}
}
}
iter = iterateGenerators(config, dialect);
while (iter.hasNext()) {
PersistentIdentifierGenerator generator = (PersistentIdentifierGenerator) iter.next();
Object key = generator.generatorKey();
if (!databaseMetadata.isSequence(key) && !databaseMetadata.isTable(key)) { throw new HibernateException(
"Missing sequence or table: " + key); }
}
return null;
}
代码示例来源:origin: jhipster/jhipster-loaded
Mapping mapping = cfg.buildMapping();
内容来源于网络,如有侵权,请联系作者删除!