private Collection<ObjAttribute> getMutablePrimaryKeys() { if (getDbEntity() == null) { throw new CayenneRuntimeException("No DbEntity for ObjEntity: " + getName()); } Collection<DbAttribute> pkAttributes = getDbEntity().getPrimaryKeys(); Collection<ObjAttribute> attributes = new ArrayList<ObjAttribute>(pkAttributes.size()); for (DbAttribute pk : pkAttributes) { ObjAttribute attribute = getAttributeForDbAttribute(pk); // create synthetic attribute if (attribute == null) { attribute = new SyntheticPKObjAttribute(NameConverter.underscoredToJava(pk.getName(), false)); attribute.setDbAttributePath(pk.getName()); attribute.setType(TypesMapping.getJavaBySqlType(pk.getType())); } attributes.add(attribute); } return attributes; }