当前位置: 首页>>代码示例>>Java>>正文


Java UniqueConstraint.columnNames方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:liefke,项目名称:org.fastnate,代码行数:26,代码来源:EntityClass.java


示例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;
}
 
开发者ID:ddRPB,项目名称:rpb,代码行数:16,代码来源:JpaUniqueUtil.java


示例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);
		}
	}
}
 
开发者ID:liefke,项目名称:org.fastnate,代码行数:8,代码来源:EntityClass.java


示例4: UniqueConstraintDef

import javax.persistence.UniqueConstraint; //导入方法依赖的package包/类
public UniqueConstraintDef(UniqueConstraint unique) {
	this.name=unique.name();
	this.columnNames=unique.columnNames();
}
 
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:5,代码来源:UniqueConstraintDef.java



注:本文中的javax.persistence.UniqueConstraint.columnNames方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。