Hi, i have a problem when updating into 2 tables in the DB.
Firstly, i have a table to store all the details and another table to store the attachment.
Secondly, i have a page to modify the details and the attachment. For the updating of the details is ok but when updating the attachment, there would have problem.
Users can choose whether to change the attachment file or not. if user choose not to change it, then it should remain the same attachment as before but i can't seem to achieve that. Instead it stores the attachment as blank after i update it.
Below is the codes i used to get the attachment from the browse textbox n stores into the DB.
if(oForm.getFile() != null){
if(oForm.getFile().getFileSize()>0){
oResearchPaper.setFiles(new HashSet());
oAtt.setFile(oForm.getFile().getFileData());
oAtt.setFilename(oForm.getFile().getFileName());
oResearchPaper.getFiles().add(oAtt);
oAtt.setResearchPaper(oResearchPaper);
}
}
How do i do it in a way that when the browse textbox is empty and we click the update button, the attachment will still remain the same one, meaning the user don't want to modify the attachment.