use of org.jboss.tools.hibernate.runtime.spi.IConfiguration in project jbosstools-hibernate by jbosstools.
the class SchemaExportFacadeImpl method setConfiguration.
public void setConfiguration(IConfiguration configuration) {
Configuration configurationTarget = (Configuration) ((IFacade) configuration).getTarget();
this.metadata = MetadataHelper.getMetadata(configurationTarget);
}
use of org.jboss.tools.hibernate.runtime.spi.IConfiguration in project jbosstools-hibernate by jbosstools.
the class ColumnFacadeImpl method getSqlType.
@Override
public String getSqlType(IConfiguration configuration) {
Column targetColumn = (Column) getTarget();
Configuration configurationTarget = (Configuration) ((IFacade) configuration).getTarget();
Properties properties = configurationTarget.getProperties();
StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
ssrb.applySettings(properties);
StandardServiceRegistry ssr = ssrb.build();
DialectFactory df = ssr.getService(DialectFactory.class);
Dialect dialectTarget = df.buildDialect(properties, null);
return targetColumn.getSqlType(dialectTarget, MetadataHelper.getMetadata(configurationTarget));
}
use of org.jboss.tools.hibernate.runtime.spi.IConfiguration in project jbosstools-hibernate by jbosstools.
the class OrmDiagram method refreshRootsFromNames.
public boolean refreshRootsFromNames() {
final IConfiguration config = getConfig();
if (config == null) {
return false;
}
for (int i = 0; i < roots.size(); i++) {
IPersistentClass newOrmElement = config.getClassMapping(entityNames.get(i));
if (roots.get(i) == null) {
if (newOrmElement == null) {
continue;
}
} else if (roots.get(i).equals(newOrmElement)) {
continue;
}
roots.set(i, newOrmElement);
}
return true;
}
use of org.jboss.tools.hibernate.runtime.spi.IConfiguration in project jbosstools-hibernate by jbosstools.
the class HbmExporterTest method testProperty.
public void testProperty() {
// $NON-NLS-1$
IConfiguration config = getConfigurationFor("pack.A");
// $NON-NLS-1$ //$NON-NLS-2$
checkClassesMaped(config, "pack.A", "pack.B");
// $NON-NLS-1$
IPersistentClass a = config.getClassMapping("pack.A");
// $NON-NLS-1$
IProperty prop = a.getProperty("prop");
assertNotNull(prop.getValue());
IValue value = prop.getValue();
// $NON-NLS-1$
assertTrue("Expected to get ManyToOne-type mapping", value.isManyToOne());
// $NON-NLS-1$
assertEquals("pack.B", value.getTypeName());
}
use of org.jboss.tools.hibernate.runtime.spi.IConfiguration in project jbosstools-hibernate by jbosstools.
the class HbmExporterTest method testSet.
public void testSet() {
// $NON-NLS-1$
IConfiguration config = getConfigurationFor("pack.A");
// $NON-NLS-1$ //$NON-NLS-2$
checkClassesMaped(config, "pack.A", "pack.B");
// $NON-NLS-1$
IPersistentClass a = config.getClassMapping("pack.A");
// $NON-NLS-1$
IPersistentClass b = config.getClassMapping("pack.B");
// $NON-NLS-1$
IProperty setProp = a.getProperty("set");
assertNotNull(setProp.getValue());
IValue value = setProp.getValue();
assertTrue("Expected to get Set-type mapping", value.isSet());
assertTrue(value.getCollectionElement().isOneToMany());
assertTrue(value.getCollectionTable().equals(b.getTable()));
assertNotNull(value.getKey());
}
Aggregations