本文整理汇总了Java中javax.persistence.UniqueConstraint.columnNames方法的典型用法代码示例。如果您正苦于以下问题:Java UniqueConstraint.columnNames方法的具体用法?Java UniqueConstraint.columnNames怎么用?Java UniqueConstraint.columnNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.UniqueConstraint
的用法示例。
在下文中一共展示了UniqueConstraint.columnNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instpectUniqueConstraint
import javax.persistence.UniqueConstraint; //导入方法依赖的package包/类
private void instpectUniqueConstraint(final UniqueConstraint constraint) {
UniquePropertyQuality currentQuality = UniquePropertyQuality.onlyRequiredPrimitives;
final List<SingularProperty<E, ?>> uniques = new ArrayList<>();
final String[] columnNames = constraint.columnNames();
for (final String columnName : columnNames) {
for (final Property<E, ?> property : this.properties.values()) {
if (property instanceof SingularProperty) {
final SingularProperty<E, ?> singularProperty = (SingularProperty<E, ?>) property;
if (columnName.equals(singularProperty.getColumn().getName())) {
final UniquePropertyQuality quality = UniquePropertyQuality.getMatchingQuality(property);
if (quality != null) {
if (quality.ordinal() > currentQuality.ordinal()) {
currentQuality = quality;
}
uniques.add(singularProperty);
}
}
}
}
}
if (uniques.size() == columnNames.length && isBetterUniquePropertyQuality(currentQuality)) {
this.uniqueProperties = uniques;
this.uniquePropertiesQuality = currentQuality;
}
}
示例2: getPropertyConstraints
import javax.persistence.UniqueConstraint; //导入方法依赖的package包/类
private Map<String, Object> getPropertyConstraints(Object entity, Class<?> entityClass, UniqueConstraint u, String prefix) {
Map<String, Object> values = newHashMap();
for (String column : u.columnNames()) {
Method method = columnNameToMethod(entityClass, column);
if (method != null) {
values.put(prefix + methodToProperty(method), invokeMethod(method, entity));
} else {
Field field = columnNameToField(entityClass, column);
if (field != null) {
values.put(prefix + field.getName(), getValueFromField(field, entity));
}
}
}
return values;
}
示例3: buildUniqueProperties
import javax.persistence.UniqueConstraint; //导入方法依赖的package包/类
private void buildUniqueProperties(final UniqueConstraint[] uniqueConstraints) {
for (final UniqueConstraint constraint : uniqueConstraints) {
if (constraint.columnNames().length <= this.context.getMaxUniqueProperties()) {
instpectUniqueConstraint(constraint);
}
}
}
示例4: UniqueConstraintDef
import javax.persistence.UniqueConstraint; //导入方法依赖的package包/类
public UniqueConstraintDef(UniqueConstraint unique) {
this.name=unique.name();
this.columnNames=unique.columnNames();
}