本文整理汇总了Java中org.eclipse.persistence.mappings.DatabaseMapping.isPrimaryKeyMapping方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMapping.isPrimaryKeyMapping方法的具体用法?Java DatabaseMapping.isPrimaryKeyMapping怎么用?Java DatabaseMapping.isPrimaryKeyMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.persistence.mappings.DatabaseMapping
的用法示例。
在下文中一共展示了DatabaseMapping.isPrimaryKeyMapping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractIdPropertyNames
import org.eclipse.persistence.mappings.DatabaseMapping; //导入方法依赖的package包/类
@Override
public String[] extractIdPropertyNames(Object entity)
{
final EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(emf);
final ClassDescriptor desc = em.unwrap(JpaEntityManager.class).getServerSession().getClassDescriptor(entity);
if (desc != null)
{
final Collection<DatabaseMapping> fieldNames = desc.getMappings();
final List<DatabaseMapping> tmp = new LinkedList<>();
for (DatabaseMapping m : fieldNames)
{
if (m.isPrimaryKeyMapping())
{
tmp.add(m);
}
}
final String[] retVal = new String[tmp.size()];
for (int i = 0; i < retVal.length; i++)
{
retVal[i] = tmp.get(i).getAttributeName();
}
return retVal;
}
return null;
}
示例2: 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);
}
}
}