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


Java DatabaseMapping.isDirectToFieldMapping方法代码示例

本文整理汇总了Java中org.eclipse.persistence.mappings.DatabaseMapping.isDirectToFieldMapping方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMapping.isDirectToFieldMapping方法的具体用法?Java DatabaseMapping.isDirectToFieldMapping怎么用?Java DatabaseMapping.isDirectToFieldMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.persistence.mappings.DatabaseMapping的用法示例。


在下文中一共展示了DatabaseMapping.isDirectToFieldMapping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: camelCaseToUnderscore

import org.eclipse.persistence.mappings.DatabaseMapping; //导入方法依赖的package包/类
private void camelCaseToUnderscore(Vector<DatabaseMapping> mappings) {
    for (DatabaseMapping mapping : mappings) {
        DatabaseField field = mapping.getField();
        if (mapping.isDirectToFieldMapping() && !mapping.isPrimaryKeyMapping()) {
            String attributeName = mapping.getAttributeName();
            String underScoredFieldName = camelCaseToUnderscore(attributeName);
            field.setName(underScoredFieldName);
        }
    }
}
 
开发者ID:antoniomaria,项目名称:karaf4-eclipselink-jpa,代码行数:11,代码来源:CamelNamingStrategy.java

示例2: customize

import org.eclipse.persistence.mappings.DatabaseMapping; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void customize(Session session) throws Exception {
    Map<Class, ClassDescriptor> descriptors = session.getDescriptors();
    // iterate all descriptors
    for (ClassDescriptor classDescriptor : descriptors.values()) {
        // iterate the mappings of each descriptor
        for (DatabaseMapping databaseMapping : classDescriptor.getMappings()) {
            // process embedded properties
            if (databaseMapping.isAggregateObjectMapping()) {
                AggregateObjectMapping m = (AggregateObjectMapping) databaseMapping;
                Map<String, DatabaseField> fieldMapping = m.getAggregateToSourceFields();

                // iterate the mappings of the embeddable class
                for (DatabaseMapping refMapping : descriptors.get(m.getReferenceClass()).getMappings()) {
                    if (refMapping.isDirectToFieldMapping()) {
                        DirectToFieldMapping refDirectMapping = (DirectToFieldMapping) refMapping;
                        String refFieldName = refDirectMapping.getField().getName();
                        if (!fieldMapping.containsKey(refFieldName)) {
                            DatabaseField mappedField = refDirectMapping.getField().clone();
                            mappedField.setName(m.getAttributeName() + "_" + mappedField.getName());
                            fieldMapping.put(refFieldName, mappedField);
                        }
                    }

                }
            }

        }
    }
}
 
开发者ID:ruediste,项目名称:rise,代码行数:32,代码来源:EmbeddedFieldNamesSessionCustomizer.java


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