Results 1 to 3 of 3
  1. #1
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default Updating into 2 tables in the DB

    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.

    Java Code:
    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.

  2. #2
    sandor is offline Member
    Join Date
    Apr 2007
    Location
    Pennsylvania,USA
    Posts
    45
    Rep Power
    0

    Default

    Why does the update screen not have the name of the attachment right there on it like it has the other data?
    ..unless I am misunderstanding your question.

  3. #3
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    I think you need to tell us more about this , like the db you are using if JDBC then should tell the table structure ,etc By the way there is group called database with in the forum , It appeals to me that this topic should go there

Similar Threads

  1. Help needed with updating mysql database
    By SilentCodingOne in forum New To Java
    Replies: 1
    Last Post: 12-11-2007, 10:23 PM
  2. Updating Local Content
    By ibanez270dx in forum Java Applets
    Replies: 1
    Last Post: 11-02-2007, 01:55 AM
  3. Problems updating blob columns on Oracle 9
    By ljustiniano in forum JDBC
    Replies: 0
    Last Post: 08-14-2007, 06:17 PM
  4. dynamically updating clock
    By malakaherath in forum New To Java
    Replies: 2
    Last Post: 08-01-2007, 07:57 PM
  5. Updating Graphics
    By Greedful in forum Java 2D
    Replies: 2
    Last Post: 07-20-2007, 07:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •