use of org.hibernate.engine.Mapping in project xwiki-platform by xwiki.
the class AbstractDropNotNullDataMigration method getLiquibaseChangeLog.
@Override
public String getLiquibaseChangeLog() throws DataMigrationException {
XWikiHibernateBaseStore store = getStore();
Dialect dialect = store.getDialect();
Configuration configuration = store.getConfiguration();
Mapping mapping = configuration.buildMapping();
PersistentClass pClass = configuration.getClassMapping(this.table.getName());
Column column = ((Column) pClass.getProperty(this.property).getColumnIterator().next());
String columnType = column.getSqlType(dialect, mapping);
StringBuilder builder = new StringBuilder();
builder.append("<changeSet author=\"xwiki\" id=\"R").append(this.getVersion().getVersion()).append("\">\n");
builder.append(" <dropNotNullConstraint\n");
builder.append(" columnDataType=\"").append(columnType).append('"').append('\n');
builder.append(" columnName=\"").append(column.getName()).append('"').append('\n');
builder.append(" tableName=\"").append(pClass.getTable().getName()).append("\"/>\n");
builder.append("</changeSet>");
return builder.toString();
}
Aggregations