MIBuilderHelper mibh,
boolean isGCId) throws SpeedoException, PException {
//Find the unique pkField in order to get its name and its type
String fieldName;
PType fieldType;
SpeedoField pkField = sf.moClass.getUniquePKField();
if (isGCId) {
//create hidden field in the GenClassRef for its identifier
// the create field has a name built from the GCR name itself
if (pkField == null) {
//there is no pk field defined ==> new one
fieldName = ID_FIELD;
fieldType = PTypeSpace.OBJLONG;
} else {
fieldName = pkField.name;
//Check the PK field type (Long or long only supported)
String type = pkField.type();
if ("java.lang.Long".equals(type) || "Long".equals(type)) {
fieldType = PTypeSpace.OBJLONG;
} else if ("long".equals(type)) {
fieldType = PTypeSpace.LONG;
} else {
throw new SpeedoException(
"Impossible to use an auto incremented identifier: " +
"the field type of '" + pkField.name + "' is '" + pkField.type()
+ "' and 'java.lang.Long' or long is expected (class '"
+ pkField.moClass.getFQName() + "'.");
}
}
String prefix = mibh.getNameDefFieldPrefix(gcr, isGCId, isGCId, sf);