本文整理汇总了Java中org.hibernate.mapping.Column.getQuotedName方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getQuotedName方法的具体用法?Java Column.getQuotedName怎么用?Java Column.getQuotedName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.mapping.Column
的用法示例。
在下文中一共展示了Column.getQuotedName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModifyColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getModifyColumnSql(Mapping mapping, Column column, boolean changeNotNull, boolean changeType)
{
String columnName = column.getQuotedName(this);
String nullStr = "";
if( changeNotNull )
{
nullStr = column.isNullable() ? " NULL" : " NOT NULL";
}
String typeStr = "";
if( changeType )
{
typeStr = ' ' + column.getSqlType(this, mapping);
}
return "MODIFY (" + columnName + typeStr + nullStr + ")";
}
示例2: getModifyColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getModifyColumnSql(Mapping mapping, Column column, boolean changeNotNull, boolean changeType)
{
StringBuilder sbuf = new StringBuilder();
String columnName = column.getQuotedName(this);
if( changeNotNull )
{
sbuf.append("ALTER COLUMN ");
sbuf.append(columnName).append(' ');
sbuf.append(column.isNullable() ? "DROP" : "SET");
sbuf.append(" NOT NULL");
}
if( changeType )
{
if( changeNotNull )
{
sbuf.append(", ");
}
sbuf.append("ALTER COLUMN ");
sbuf.append(columnName).append(" TYPE ").append(column.getSqlType(this, mapping));
}
return sbuf.toString();
}
示例3: bindLogicalToPhysical
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
private void bindLogicalToPhysical(String logicalName, Column physicalColumn) throws DuplicateMappingException {
final String logicalKey = logicalName.toLowerCase();
final String physicalName = physicalColumn.getQuotedName();
final String existingPhysicalName = ( String ) logicalToPhysical.put( logicalKey, physicalName );
if ( existingPhysicalName != null ) {
boolean areSamePhysicalColumn = physicalColumn.isQuoted()
? existingPhysicalName.equals( physicalName )
: existingPhysicalName.equalsIgnoreCase( physicalName );
if ( ! areSamePhysicalColumn ) {
throw new DuplicateMappingException(
" Table [" + tableName + "] contains logical column name [" + logicalName
+ "] referenced by multiple physical column names: [" + existingPhysicalName
+ "], [" + physicalName + "]",
"column-binding",
tableName + "." + logicalName
);
}
}
}
示例4: getModifyColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getModifyColumnSql(Mapping mapping, Column column, boolean changeNotNull, boolean changeType)
{
String columnName = column.getQuotedName(this);
String nullStr = column.isNullable() ? " NULL" : " NOT NULL";
String typeStr = ' ' + column.getSqlType(this, mapping);
return "ALTER COLUMN " + columnName + typeStr + nullStr;
}
示例5: getAddNotNullSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getAddNotNullSql(Mapping mapping, Column column)
{
String columnName = column.getQuotedName(this);
String typeStr = ' ' + column.getSqlType(this, mapping);
return "ALTER COLUMN " + columnName + typeStr + " NOT NULL";
}
示例6: getDropColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getDropColumnSql(String table, Column column)
{
String dropSQL = dropConstraintsSQL.replaceAll("\\$table", Matcher.quoteReplacement(table));
dropSQL = dropSQL.replaceAll("\\$column", Matcher.quoteReplacement(column.getName()));
return dropSQL + "\nalter table " + table + " drop column " + column.getQuotedName(this);
}
示例7: bindPhysicalToLogical
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
private void bindPhysicalToLogical(String logicalName, Column physicalColumn) throws DuplicateMappingException {
final String physicalName = physicalColumn.getQuotedName();
final String existingLogicalName = ( String ) physicalToLogical.put( physicalName, logicalName );
if ( existingLogicalName != null && ! existingLogicalName.equals( logicalName ) ) {
throw new DuplicateMappingException(
" Table [" + tableName + "] contains physical column name [" + physicalName
+ "] represented by different logical column names: [" + existingLogicalName
+ "], [" + logicalName + "]",
"column-binding",
tableName + "." + physicalName
);
}
}
示例8: applyMin
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
private static void applyMin(Property property, ConstraintDescriptor<?> descriptor, Dialect dialect) {
if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
long min = minConstraint.getAnnotation().value();
Column col = (Column) property.getColumnIterator().next();
String checkConstraint = col.getQuotedName(dialect) + ">=" + min;
applySQLCheck( col, checkConstraint );
}
}
示例9: applyMax
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
private static void applyMax(Property property, ConstraintDescriptor<?> descriptor, Dialect dialect) {
if ( Max.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Max> maxConstraint = (ConstraintDescriptor<Max>) descriptor;
long max = maxConstraint.getAnnotation().value();
Column col = (Column) property.getColumnIterator().next();
String checkConstraint = col.getQuotedName(dialect) + "<=" + max;
applySQLCheck( col, checkConstraint );
}
}
示例10: addColumnBinding
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
public void addColumnBinding(String logicalName, Column finalColumn, Table table) {
ColumnNames binding = (ColumnNames) columnNameBindingPerTable.get(table);
if (binding == null) {
binding = new ColumnNames();
columnNameBindingPerTable.put(table, binding);
}
String oldFinalName = (String) binding.logicalToPhysical.put(
logicalName.toLowerCase(),
finalColumn.getQuotedName()
);
if ( oldFinalName != null &&
! ( finalColumn.isQuoted() ?
oldFinalName.equals( finalColumn.getQuotedName() ) :
oldFinalName.equalsIgnoreCase( finalColumn.getQuotedName() ) ) ) {
//TODO possibly relax that
throw new MappingException("Same logical column name referenced by different physical ones: "
+ table.getName() + "." + logicalName + " => '" + oldFinalName + "' and '" + finalColumn.getQuotedName() + "'" );
}
String oldLogicalName = (String) binding.physicalToLogical.put(
finalColumn.getQuotedName(),
logicalName
);
if ( oldLogicalName != null && ! oldLogicalName.equals( logicalName ) ) {
//TODO possibly relax that
throw new MappingException("Same physical column represented by different logical column names: "
+ table.getName() + "." + finalColumn.getQuotedName() + " => '" + oldLogicalName + "' and '" + logicalName + "'");
}
}
示例11: getAddNotNullSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getAddNotNullSql(Mapping mapping, Column column)
{
String columnName = column.getQuotedName(this);
return "MODIFY (" + columnName + " NOT NULL)";
}
示例12: getRenameColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getRenameColumnSql(String table, Column column, String name)
{
String columnName = column.getQuotedName(this);
return "ALTER TABLE " + table + " RENAME COLUMN " + columnName + " TO " + name;
}
示例13: getDropColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getDropColumnSql(String table, Column column)
{
return "ALTER TABLE " + table + " DROP COLUMN " + column.getQuotedName(this) + " CASCADE CONSTRAINTS";
}
示例14: getAddNotNullSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getAddNotNullSql(Mapping mapping, Column column)
{
String columnName = column.getQuotedName(this);
return "ALTER COLUMN " + columnName + " SET NOT NULL";
}
示例15: getDropColumnSql
import org.hibernate.mapping.Column; //导入方法依赖的package包/类
@Override
public String getDropColumnSql(String table, Column column)
{
return "alter table " + table + " drop column " + column.getQuotedName(this);
}