use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class RelationalPersistentEntityImpl method getTableName.
/*
* (non-Javadoc)
* @see org.springframework.data.relational.mapping.model.RelationalPersistentEntity#getTableName()
*/
@Override
public SqlIdentifier getTableName() {
SqlIdentifier schema = determineCurrentEntitySchema();
Optional<SqlIdentifier> explicitlySpecifiedTableName = tableName.get();
final SqlIdentifier schemalessTableIdentifier = createDerivedSqlIdentifier(namingStrategy.getTableName(getType()));
if (schema == null) {
return explicitlySpecifiedTableName.orElse(schemalessTableIdentifier);
}
return explicitlySpecifiedTableName.map(sqlIdentifier -> SqlIdentifier.from(schema, sqlIdentifier)).orElse(SqlIdentifier.from(schema, schemalessTableIdentifier));
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class Criteria method and.
/**
* Create a new {@link Criteria} and combine it with {@code AND} using the provided {@code column} name.
*
* @param column Must not be {@literal null} or empty.
* @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
*/
public CriteriaStep and(String column) {
Assert.hasText(column, "Column name must not be null or empty!");
SqlIdentifier identifier = SqlIdentifier.unquoted(column);
return new DefaultCriteriaStep(identifier) {
@Override
protected Criteria createCriteria(Comparator comparator, @Nullable Object value) {
return new Criteria(Criteria.this, Combinator.AND, Collections.emptyList(), identifier, comparator, value);
}
};
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class JdbcRepositoryEmbeddedWithReferenceIntegrationTests method countRowsInTable.
private int countRowsInTable(String name, long idValue) {
SqlIdentifier id = SqlIdentifier.quoted("ID");
String whereClause = id.toSql(dialect.getIdentifierProcessing()) + " = " + idValue;
return JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), name, whereClause);
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class Criteria method or.
/**
* Create a new {@link Criteria} and combine it with {@code OR} using the provided {@code column} name.
*
* @param column Must not be {@literal null} or empty.
* @return a new {@link CriteriaStep} object to complete the next {@link Criteria}.
*/
public CriteriaStep or(String column) {
Assert.hasText(column, "Column name must not be null or empty!");
SqlIdentifier identifier = SqlIdentifier.unquoted(column);
return new DefaultCriteriaStep(identifier) {
@Override
protected Criteria createCriteria(Comparator comparator, @Nullable Object value) {
return new Criteria(Criteria.this, Combinator.OR, Collections.emptyList(), identifier, comparator, value);
}
};
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class SqlContext method getTable.
Table getTable(PersistentPropertyPathExtension path) {
SqlIdentifier tableAlias = path.getTableAlias();
Table table = Table.create(path.getTableName());
return tableAlias == null ? table : table.as(tableAlias);
}
Aggregations