//derive the AttachmentType
String key = ufvo.getMyFileTypeId();
AttachmentType type = TypeUtil.forKey(AttachmentType.class,key );
//create a new Attachment for insertion.
Attachment att = new Attachment();
att.setName(ufvo.getMyFile().getFileName());
att.setDescription(type.getDescription());
att.setType(type);
try {
att.setContents(ufvo.getMyFile().getFileData());
} catch (IOException e) {
e.printStackTrace();
}
//determine the student uploading the file