throw new RuntimeException(e1.getMessage());
}
// Instantiate ssnr field descriptor
ssnrFieldDescr = new FieldDescriptorImpl(ssnrFieldName, ssnrType,ssnrHandler, false);
ssnrFieldDescr.addNature(FieldDescriptorJDONature.class.getName());
FieldDescriptorJDONature ssnrFieldJdoNature = new FieldDescriptorJDONature(ssnrFieldDescr);
ssnrFieldJdoNature.setSQLName(new String[] { "ssnr" });
ssnrFieldJdoNature.setSQLType(new int[] {SQLTypeInfos.javaType2sqlTypeNum(java.lang.Long.class) });
ssnrFieldJdoNature.setManyTable(null);
ssnrFieldJdoNature.setManyKey(new String[] {});
ssnrFieldJdoNature.setDirtyCheck(false);
ssnrFieldJdoNature.setReadOnly(false);
ssnrFieldDescr.setContainingClassDescriptor(this);
ssnrFieldDescr.setIdentity(true);
ssnrFM.setIdentity(true);
ssnrFM.setDirect(false);
ssnrFM.setName("ssnr");
ssnrFM.setRequired(true);
ssnrFM.setSetMethod("setSsnr");
ssnrFM.setGetMethod("getSsnr");
Sql ssnrSql = new Sql();
ssnrSql.addName("ssnr");
ssnrSql.setType("integer");
ssnrFM.setSql(ssnrSql);
ssnrFM.setType("long");
choice.addFieldMapping(ssnrFM);
//firstName field
String firstNameFieldName = "firstName";
FieldDescriptorImpl firstNameFieldDescr;
FieldMapping firstNameFM = new FieldMapping();
TypeInfo firstNameType = new TypeInfo(java.lang.String.class);
// Set columns required (= not null)
firstNameType.setRequired(true);
FieldHandler firstNameHandler;
try {
Method firstNameGetMethod = Father.class.getMethod("getFirstName", null);
Method firstNameSetMethod = Father.class.getMethod("setFirstName", new Class[]{
java.lang.String.class});
firstNameHandler = new FieldHandlerImpl(firstNameFieldName, null, null,
firstNameGetMethod, firstNameSetMethod, firstNameType);
} catch (SecurityException e1) {
throw new RuntimeException(e1.getMessage());
} catch (MappingException e1) {
throw new RuntimeException(e1.getMessage());
} catch (NoSuchMethodException e1) {
throw new RuntimeException(e1.getMessage());
}
// Instantiate firstName field descriptor
firstNameFieldDescr = new FieldDescriptorImpl(firstNameFieldName, firstNameType,firstNameHandler, false);
firstNameFieldDescr.addNature(FieldDescriptorJDONature.class.getName());
FieldDescriptorJDONature firstNameFieldJdoNature = new FieldDescriptorJDONature(firstNameFieldDescr);
firstNameFieldJdoNature.setSQLName(new String[] { "firstName" });
firstNameFieldJdoNature.setSQLType(new int[] {SQLTypeInfos.javaType2sqlTypeNum(java.lang.String.class) });
firstNameFieldJdoNature.setManyTable(null);
firstNameFieldJdoNature.setManyKey(new String[] {});
firstNameFieldJdoNature.setDirtyCheck(false);
firstNameFieldJdoNature.setReadOnly(false);
firstNameFieldDescr.setContainingClassDescriptor(this);
firstNameFieldDescr.setIdentity(false);
firstNameFM.setIdentity(false);
firstNameFM.setDirect(false);
firstNameFM.setName("firstName");
firstNameFM.setRequired(true);
firstNameFM.setSetMethod("setFirstName");
firstNameFM.setGetMethod("getFirstName");
Sql firstNameSql = new Sql();
firstNameSql.addName("firstName");
firstNameSql.setType("varchar");
firstNameFM.setSql(firstNameSql);
firstNameFM.setType("java.lang.String");
choice.addFieldMapping(firstNameFM);
//lastName field
String lastNameFieldName = "lastName";
FieldDescriptorImpl lastNameFieldDescr;
FieldMapping lastNameFM = new FieldMapping();
TypeInfo lastNameType = new TypeInfo(java.lang.String.class);
// Set columns required (= not null)
lastNameType.setRequired(true);
FieldHandler lastNameHandler;
try {
Method lastNameGetMethod = Father.class.getMethod("getLastName", null);
Method lastNameSetMethod = Father.class.getMethod("setLastName", new Class[]{
java.lang.String.class});
lastNameHandler = new FieldHandlerImpl(lastNameFieldName, null, null,
lastNameGetMethod, lastNameSetMethod, lastNameType);
} catch (SecurityException e1) {
throw new RuntimeException(e1.getMessage());
} catch (MappingException e1) {
throw new RuntimeException(e1.getMessage());
} catch (NoSuchMethodException e1) {
throw new RuntimeException(e1.getMessage());
}
// Instantiate lastName field descriptor
lastNameFieldDescr = new FieldDescriptorImpl(lastNameFieldName, lastNameType,lastNameHandler, false);
lastNameFieldDescr.addNature(FieldDescriptorJDONature.class.getName());
FieldDescriptorJDONature lastNameFieldJdoNature = new FieldDescriptorJDONature(lastNameFieldDescr);
lastNameFieldJdoNature.setSQLName(new String[] { "lastName" });
lastNameFieldJdoNature.setSQLType(new int[] {SQLTypeInfos.javaType2sqlTypeNum(java.lang.String.class) });
lastNameFieldJdoNature.setManyTable(null);
lastNameFieldJdoNature.setManyKey(new String[] {});
lastNameFieldJdoNature.setDirtyCheck(false);
lastNameFieldJdoNature.setReadOnly(false);
lastNameFieldDescr.setContainingClassDescriptor(this);
lastNameFieldDescr.setIdentity(false);
lastNameFM.setIdentity(false);
lastNameFM.setDirect(false);