Io exception - cannot close same stream twice

Hi.
Hoping someone can help with this problem. I have a JSP page which is receiving an XML request. Currently I pass the InputStream onto another class (whose source I do not have access to and cannot modify) and this parses the stream and creates a document (and I believe in doing so this closes the stream...is that correct?).
Problem is that now I have to change this JSP page because I need to determine the value of a tag within the XML request before I decide whether to call this class or not. I thought I'd create parse the stream into a document and then reference the node that way. I was able to do this and read the value of that node, but then when I called the class it threw the exception.
So basically I need another way to read the tag from the XML request without closing the stream down. I read some other posts that talked about creating a StringReader and using that, but wouldn't that close the input stream? I also read about using the mark() and reset() methods, but markSupported() returns "false" so I don't think I can use those.
Any ideas will be much appreciated.

Ok, I've tried implemented the solution you suggested but have one problem. I cannot determine the length of the request so I don't know what length to initialise the byte array with. I thought I could use the available() method but this always returns 0. Here is my code (the request is a ServletRequest)...
ServletInputStream sis = request.getInputStream();
int numOfBytes = sis.available();
System.out.println( sis.available() ); //debug
byte b[] = new byte[numOfBytes];
String resultVal = "";
sis.read( b );
ByteArrayInputStream bais = new ByteArrayInputStream( b );
bais.mark( numOfBytes );
// Check whether it is good or bad result
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db=dbf.newDocumentBuilder();
Document doc=db.parse(bais);
NodeList resultNode = doc.getElementsByTagName("result");
resultVal = resultNode.item(0).getFirstChild().getNodeValue();
// Test whether stream can be re-used
bais.reset();
DocumentBuilderFactory dbf2=DocumentBuilderFactory.newInstance();
DocumentBuilder db2=dbf2.newDocumentBuilder();
Document doc2=db2.parse(bais);
if( resultVal.equalsIgnoreCase( "success" ) )
System.out.println( "success!");
else
System.out.println( "not success!");
//more code to call other class with inputstream which parses it into a document
Is there another way I can create the ByteArrayStream? or determine the length of the request?

Similar Messages

  • Error : Old and new exceptions cannot be used at the same time.

    HI ALL,
    i build a new exception class with message class and i want to replace the
    old exception that i had in the method ,what i did is delete the exception from the method
    signature and add the exception class .
    the problem is that when i try to activate the method i get error :
    Old and new exceptions cannot be used at the same time.
    CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'
          EXPORTING
            alg            = 'MD5'
            data           = iv_iss
          IMPORTING
            hash           = lv_issu
          EXCEPTIONS
            unknown_alg    = 1
            param_error    = 2
            internal_error = 3
            OTHERS         = 4.
        IF sy-subrc <> 0.
          RAISE EXCEPTION TYPE cx_user_mng EXPORTING
          textid = cx_user_mng=>wrong_isrs.
        ENDIF.
    I want to use the new exception class ,
    how can i avoid this error ?
    Best Regards
    Edited by: Joy Stpr on Jul 22, 2009 2:56 PM
    Edited by: Joy Stpr on Jul 22, 2009 3:16 PM

    Hi Joy,
    Check this link.
    [Old and New Exceptions Cannot be used at same time|Urgent problem, give me a hand;
    Old and new exceptions cannot be used the same time, what does this mean???
    Regards,
    Lakshman.

  • After backup, TM cannot eject itself automatically, and then both my mac and TM get high temperature. why is that, I had the same problem twice.

    after backup, TM cannot eject itself automatically, and then both my mac and TM get high temperature. why is that, I had the same problem twice. I re-start my mac, it doesn't work at tall, still the same problem.

    Are you saying, right now that the TM refuses to work even after a re-boot?
    Is the light solid green at least?

  • Events cannot have multiple exceptions for the same date

    I just starting getting this message and could not sync to one of my Google calendars. I'm posting this for others who might get the same problem.
    I didn't find the answer on these forums but did find it on this thread on Google:
    http://www.google.com/support/forum/p/Calendar/thread?tid=241155f758d9e2a4&hl=en
    Here's the important excerpt:
    "I had a client, who just had this same issue, nothing to do with Google cals.
    It was apparently, in my best guess, a corruption of the subscribed cal.
    *I did a get info on the cal, copied the URL, deleted the cal, then re-subscribed to it by pasting in the URL, and now it's working fine*."

    I've been having the same problem with my iCal calendars and the "Events cannot have multiple exceptions for the same date" error. Once it gets going, it uses up a lot of the CPU and resources. After reinstalling iCal, all my calendars were missing and I could not even resubscribe to them.
    I took my MacBook Pro to the Apple Store, and they were able to solve the problem by moving some of the iCal files from their existing folders out to the desktop, and reopening the program. That got it working, however, now I'm having the same problem again. So back to square one. Anyone else having this issue and know the cause?
    My setup is my MacBook Pro uses Entourage, use that calendar in my iCal. And I subscribe to two calendars my wife publishes on her Macbook. We're both using Snow Leopard.

  • I cannot close or import or any function to iphoto.  I have been getting the same message for many days "Photos are being imported to the photo library.  Please wait for import to complete."  I do not know where the photos would be importing from.

    I cannot close or import or any function to iphoto.  I have been getting the same message for many days "Photos are being imported to the photo library.  Please wait for import to complete."  I do not know where the photos would be importing from.  How do I get it to proceed?

    After Force Quitting, as LarryHN recommended,
    Select the iPhoto Library in the Finder. By default it is in your Pictures folder.
    Ctrl-click or right-click the iPhoto lIbrary. Select "Show package contents" from the panel, that will pop up.
    Look for a folder named "Importing" or "Import". Remove this folder, but don't touch anything else.
    Then launch iPhoto again.
    If iPhoto now is working again, check the folder you removed, if there are any photos that you want to keep and save them.

  • Cannot borrow the same book twice

    I recently borrowed a library book but was unable to finish reading before it expired.  So, I put my name in the waiting list and am now ready to read it again.  However, ADE gives me a "Document license expired" error.  Does this mean I can't borrow the same book twice?
    Note that I've deleted all he books from my library, so there should be no record of the previous borrowing.
    Thanks!

    What Jim Lester is saying is that there's a problem with other software that
    is causing this error, and Adobe and that software manufacturer are 'working
    on it'.  While that doesn't really answer your question, at least you know
    it's not your fault.
    I'd contact your library and tell them the problem you have.  Maybe they've
    worked out a solution that bypasses the software 'bug'.
    ================

  • A simple question: do i have to close the stream?

    do i have to close such input/output stream:
    HttpServletRequest.getInputStream()
    HttpServletRequest.getReader()
    HttpServletResponse.getOutputStream()
    HttpServletResponse.getWriter()
    and why?
    thanks!

    i found one reason y we won't close the streams beacause see the example and explanation;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Obtain an output stream by using the HttpServletResponse object and one of the methods shown in the following two examples:
    PrintWriter out = res.getWriter();
    ServletOutputStream out = res.getOutputStream();
    You can use both PrintWriter and ServletOutputStream in the same servlet (or in another servlet that is included in a servlet). The output of both is written to the same buffer.
    Write the contents of the response to the output stream using the print() method. You can use HTML tags in these statements. For example:
    out.print("<html><head><title>My Servlet</title>");out.print("</head><body><h1>");out.print("Welcome");out.print("</h1></body></html>");Any time you print data that a user has previously supplied, BEA recommends that you remove any HTML special characters that a user might have entered. If you do not remove these characters, your Web site could be exploited by cross-site scripting. For more information, refer to Securing Client Input in Servlets.
    Do not close the output stream by using the close() method, and avoid flushing the contents of the stream. If you do not close or flush the output stream, WebLogic Server can take advantage of persistent HTTP connections, as described in the next step.
    Optimize the response.
    By default, WebLogic Server attempts to use HTTP persistent connections whenever possible. A persistent connection attempts to reuse the same HTTP TCP/IP connection for a series of communications between client and server. Application performance improves because a new connection need not be opened for each request. Persistent connections are useful for HTML pages containing many in-line images, where each requested image would otherwise require a new TCP/IP connection.
    Using the WebLogic Server Administration Console, you can configure the amount of time that WebLogic Server keeps an HTTP connection open.
    WebLogic Server must know the length of the HTTP response in order to establish a persistent connection and automatically adds a Content-Length property to the HTTP response header. In order to determine the content length, WebLogic Server must buffer the response. However, if your servlet explicitly flushes the ServletOutputStream, WebLogic Server cannot determine the length of the response and therefore cannot use persistent connections. For this reason, you should avoid explicitly flushing the HTTP response in your servlets.
    You may decide that, in some cases, it is better to flush the response early to display information in the client before the page has completed; for example, to display a banner advertisement while some time-consuming page content is calculated. Conversely, you may want to increase the size of the buffer used by the servlet engine to accommodate a larger response before flushing the response. You can manipulate the size of the response buffer by using the related methods of the javax.servlet.ServletResponse interface.
    The default value of the WebLogic Server response buffer is 12K and the buffer size is internally calculated in terms of CHUNK_SIZE where CHUNK_SIZE = 4088 or 4Kb; if the user sets 5Kb the server rounds the request up to the nearest multiple of CHUNK_SIZE which is 2. and the buffer is set to 8176 or 8Kb.

  • How do I open same file twice in LR into Photoshop

    I like to work on the same image in two different windows in photoshop.  I like to see different options with editing on two or sometimes open the original image again to apply image to tone down editing.  When I click open in photoshop through LR4 it just goes to the file I was working on and doesn't open new copy.  How can I open same file twice in raw format? I was able to do this in previous versions and it just listed copy-...in front of the file name.
    Thanks so much,
    Melissa

    brwmmw wrote:
    Thank you Ian,  I am running trials of LR4 and CS6 and yes I am making sure I select the right one when I right click open in photoshop.  I did this action all the time in the previous versions.  There is not a tab or anything within photoshop.   Once the file is already open in photoshop  nothing happens.  If I close the file then I can open again.  I am sure this is simple, but I cannot figure it out.  I can open it as a smart object and that's it.  In the past, it would list copy-"filename" as the file name opened into photoshop a second time.
    Melissa,
    In Lightroom there is no such command as 'Open in Photoshop'. The command is 'Edit in Photoshop CSx' (x being whatever version of Ps you have installed).  I don't know what it is you're trying to achive and from where you're trying to open the file, but  I have tried Edit in CSx muliple times on 3 Mac's and a Windows 7 box in past 10 minutes and it works fine.

  • I CANNOT CLOSE THE FIRST TAB WHEN I SEARCH FOR SOMETHING AND CLOSE A SECOND TAB IT WILL NOT LET ME CLOSE THE FIRST TAB

    I CANNOT CLOSE THE FIRST TAB AFTER I TYPE IN A SEARCH
    == This happened ==
    Every time Firefox opened
    == I UPGRADED TO 3.6

    I have the same problem and tested it in Safe Mode, and did the disable the add-ons thing. Everything went OK, even up to the last add-on. There wasn't a hint of the problem anymore, so I went back to regular use of FF (3.6.12) again. WELL, THE SAME THING HAPPENED AGAIN!!! I agree with the person who said that your supposed troubleshooting is B.S. You blame the user instead of saying something useful like "OK, we heard you (and over two dozen others) and we know it's not your doing, and it's OUR PROBLEM, and we're going to look into it and figure out how to fix it, AND we'll get back to you when we do and tell you how to fix it too." THAT's the kind of answer we FF users want to hear, not some claptrap about how WE the users didn't try hard enough to fix it on our own!

  • HT204053 my wife and i have seperate itunes accounts is there a way we can link our accounts to share songs so we dont have to pay for the same song twice?

    When the first ipad came out i set it up and created an itunes account, since then she got an iphone and an ipad and everything was good. I had an android but wanted to try out the iphone. When i set it up ut jumpled all of our contacts, apps, and everythin. it was a mess.
         Since, i purchased and ipad 2 and an iphone and to keep our stuff from combing i used a different computer and created an new apple ID for myself so our info wouldnt combine, I was wondering if i did the right thing or if i should have went about it a different way. I was going to see if there was a way when she purchased a song i could get it. I dont want to pay for the same song twice and only want to share songs. If i cant do this can i copy her library and paste it into my itunes??
    Any help wouldl be greatly apprecieated we both have icloud set up but i cant figure out the best solution.

    Welcome to the world of digital media. Your can't really transfer it. I don't know what the rules are about transferring to your spouse but I do know that in some cases when you die, your heirs cannot inherit your digital media. This is why there is still an advantage to buying the CD since the usage rights belong to whomever holds the physical media.
    A possible workaround is to burn the songs to a music CD with yout account (tracks only without song titles) and then having your wife upload it as a regular music CD onto her account. It's been a while since i've done this so I'm not sure if it would work now.
    Please note that I'm not advocating copyright and/or TOS violations. I'm only suggesting ways to copy music for your own personal use which has traditonally been permitted. I only did this because I wanted to convert iTunes songs to mp3 files so I could burn them onto a data CD for use in my car. It would make sense that since married couples are a joint entity, this would be personal use.
    Also, I'm not a lawyer so don't take this as legal advice.

  • End user receving same mail , twice in a day .

    Hi,
    Throu this report , i am sending mail to a user. I the scheuld this program as background job.
    But My problem is end user receving same mail twice a day.I am sure , Program is executed onces in day.
    Plz help me to solve the problem
    REPORT  zplm008_tdr_mail_alert        .
    *DATA DECLARATION.
    DATA: it_ztdr TYPE TABLE OF ztdr WITH HEADER LINE.
    DATA  wa_maktx TYPE makt-maktx..
    *SELECTION SCREEN
    PARAMETER: p_date TYPE sy-datum DEFAULT sy-datum MODIF ID dat .
    *START-OF-SELECTION
    START-OF-SELECTION.
      SELECT * FROM  ztdr INTO TABLE it_ztdr
             WHERE  rlddt  = p_date.
      IF it_ztdr[] IS NOT INITIAL.
        LOOP AT it_ztdr.
          PERFORM send_mail.
        ENDLOOP.
      ENDIF.
    *&      Form  SEND_MAIL
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
      DATA: lt_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                       WITH HEADER LINE.
      DATA:   ls_message TYPE char255.
      DATA: lt_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            lt_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            lt_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            lt_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            gf_cnt TYPE i,
            gf_sent_all(1) TYPE c,
            gs_doc_data LIKE sodocchgi1,
            gf_error TYPE sy-subrc.
          Adds text to email text table
      lt_message = 'Hi,'.
      APPEND lt_message.CLEAR lt_message.APPEND lt_message.
      lt_message = 'Requested design is released. Pls raise the TPR (If required to be ordered).'.
      APPEND lt_message.CLEAR: lt_message.APPEND lt_message.
      lt_message = 'Details of the released design:'. APPEND lt_message.
      lt_message = '*******************************'.APPEND lt_message.CLEAR: lt_message.APPEND lt_message.
      MOVE : 'TDR No '  TO lt_message.
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-tdrid   .APPEND lt_message.
      MOVE  : 'PED Part no '  TO lt_message.
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-matnr.
      APPEND lt_message.
      CLEAR: wa_maktx.
      SELECT SINGLE maktx FROM makt INTO  wa_maktx WHERE matnr = it_ztdr-matnr.
      MOVE 'PED Part Description' TO lt_message.
      lt_message+21(1) = ':'.
      lt_message+22(40) = wa_maktx   .APPEND lt_message.
      MOVE : 'PED Part Rev no' TO lt_message .
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-matnr_rv .APPEND lt_message.
      MOVE: 'Rnd part No  ' TO lt_message .
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-ref_matnr . APPEND lt_message.
      MOVE : 'Rnd Part Rev '  TO lt_message .
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-ref_matnr_rv .APPEND lt_message.
      CLEAR: lt_message.
      APPEND lt_message.
      APPEND lt_message.
      lt_message = 'To View the Design:'.
      APPEND lt_message.
      lt_message = '*******************'.APPEND lt_message.
      CLEAR: lt_message.
      APPEND lt_message.
      lt_message ='For Standard gauge, use Transaction: ZPED_TOOLPRINT'.
      APPEND lt_message.
      lt_message ='For Non-Standard gauge, use Transaction:  ZCV04N or CV04N'.
      APPEND lt_message.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    Fill the document data.
      gs_doc_data-doc_size = 1.
      DATA subject TYPE string.
      CONCATENATE 'Design Released for'  it_ztdr-tdrid  'of'  it_ztdr-ref_matnr
            INTO subject SEPARATED BY space.
    Populate the subject/generic message attributes
      gs_doc_data-obj_langu = sy-langu.
      gs_doc_data-obj_name  = 'TDREQ'.
      gs_doc_data-obj_descr = subject .
      gs_doc_data-sensitivty = 'O'.
    Describe the body of the message
      CLEAR lt_packing_list.
      REFRESH lt_packing_list.
      lt_packing_list-transf_bin = space.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num = 0.
      lt_packing_list-body_start = 1.
      DESCRIBE TABLE lt_message LINES lt_packing_list-body_num.
      lt_packing_list-doc_type = 'RAW'.
      APPEND lt_packing_list.
      CLEAR lt_receivers.
      REFRESH lt_receivers.
    Add the recipients email address
    For SAP mail
    IF NOT GSCR_UNAME IS INITIAL.
      lt_receivers-receiver = it_ztdr-reqnm.
      lt_receivers-rec_type = 'U'.
      APPEND lt_receivers.
    ENDIF.
    For external mail
    IF NOT gs_outtab-reqnm IS INITIAL.
       lt_receivers-receiver = gs_outtab-reqnm.
       lt_receivers-rec_type = 'U'.
       APPEND lt_receivers.
    ENDIF.
    Call the FM to post the message to SAPMAIL
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gs_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = gf_sent_all
        TABLES
          packing_list               = lt_packing_list
          contents_txt               = lt_message
          receivers                  = lt_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    Store function module return code
      gf_error = sy-subrc.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Get lt_receivers return code
      LOOP AT lt_receivers.
      ENDLOOP.
      PERFORM initiate_mail_execute_program.
        CLEAR:lt_message[] , lt_message , gs_doc_data ,gf_sent_all,lt_packing_list[]
        ,lt_packing_list ,lt_receivers[], lt_receivers.
    ENDFORM.                    " SEND_MAIL
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    FORM initiate_mail_execute_program .
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM

    Hi,
    In your code
    You are looping the perform in which you are calling below FM.
    LOOP AT it_ztdr.
       PERFORM send_mail.
    ENDLOOP.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = gs_doc_data
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = gf_sent_all
    TABLES
    packing_list = lt_packing_list
    contents_txt = lt_message
    receivers = lt_receivers
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    So keep your FM after the loop.
    Pls. reward if useful...

  • After updating to iOs 8 I cannot close out programs which is eating data

    After my son updated his 5s iphone to i0S 8, he cannot close out any programs open, which is eating up data when not connected to wifi. He rebooted and it still will not close them out. Has anyone else had this problem?

    Well he is doing the same he has done in the past. Double tap home and swipe them up. When he double taps home now, it does nothing.

  • I reinstalled acrobat pro 9.0 on windows 7 Ultimate 64, it installed OK, When I open i get a large white popup screen which i cannot close... what to do?

    I reinstalled acrobat pro 9.0 on windows 7 Ultimate 64, it installed OK, When I open i get a large white popup screen which i cannot close... what to do?

    Hey jeroenb16613921,
    Please specify exactly when you get this white popup screen. While opening a PDF or launching Acrobat by double-clicking on the Acrobat icon.
    If it comes when opening a PDF, then where is this PDF actually stored?
    Let me know more on the same so that I can analyze the issue.
    Regards,
    Anubha

  • Displaying Same ResultSet Twice In A JSP Page

    I have a table that lists team names in my database. I'm trying to create a page with 2 dropdown boxes where each lists all the teams in the league (in other words, the data read in from the table). I got the first dropdown box to populate w/ this info. My question is about the 2nd dropdown box:
    Since I already have the ResultSet from the 1st dropdown, I would think it would be a waste to make another DB-read to fill in the 2nd dropdown. However, when I tried to call ResultSet.first() it gave me the error that it was TYPE_FORWARD_ONLY. I checked the documentation for Connection and it looks like there are some overloaded methods for createStatement. However, the API documentation (see below) is pretty confusing. I'm not sure what "resultSetConcurrency" or "resultSetHoldability" I need if I just want to read the same data twice. Can someone point me in the right direction?
    Statement createStatement(int resultSetType, int resultSetConcurrency)
    Creates a Statement object that will generate ResultSet objects with the given type and concurrency.
    Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
    Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.

    I am also having a very similar problem.
    I am having a table having 20 fileds.some of them r to be displayed in one table
    others in some other table.
    for this i am using a bean which returns a resultset which is then used in jsp page
    for display.But i have to call the javabean method twice which fires the query & returns the resultset.
    I cannot store so many fileds with so many rows of values in list of objects also i do not want to
    fire query twice.
    rs.movefirst() does not work, so what should i do.

  • FindByProperty Returns Same Record Twice

    I have a curious situation in which the findByProperty method is returning the same record twice. I have only two records in the file for this test, and they are both tied to the same contact ID. But, instead of bringing back both records, it brings back the first record twice. Any ideas?
    ContactNote entity
    @Entity
    @Table(name = "CONTNOTEP", schema = "CRMLIB", catalog = "S657567F", uniqueConstraints = {})
    public class ContactNote implements java.io.Serializable
         // Fields
         @Id
         @Column(name = "CONTACTID", unique = false, nullable = false, insertable = true, updatable = true, precision = 5, scale = 0)
         private Long                    contactId;
         @Temporal(TemporalType.DATE)
         @Column(name = "CNDATE", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
         private Date                    lastUpdatedDate;
         @Temporal(TemporalType.TIME)
         @Column(name = "CNTIME", unique = false, nullable = false, insertable = true, updatable = true, length = 8)
         private Date                    lastUpdatedTime;
         @Column(name = "CNNOTE", unique = false, nullable = false, insertable = true, updatable = true, length = 100)
         private String                    note;
         @Column(name = "CNSALMNUM", unique = false, nullable = false, insertable = true, updatable = true, length = 2)
         private String                    salesmanNumber;
         @ManyToOne(fetch = FetchType.LAZY, cascade = {})
         @JoinColumn(name = "CONTACTID", insertable = false, updatable = false)
         private Contact                    contact;
         @Transient
         private GregorianCalendar     date;
    ContactServiceImpl
         public List<ContactNote> getContactNotes(String sessionId, Long contactId) throws AuthenticationFault
              authenticateSession(sessionId);
              List<ContactNote> contactNoteList = contactNoteDao.findByProperty("contactId", contactId);
              if (contactNoteList.size() == 0)
                   ContactNote contactNote = new ContactNote();
                   contactNoteList.add(contactNote.defaultContactNote());
              return contactNoteList;
    JUnit Test Method
         @SuppressWarnings("unchecked")
         public void runGetContactNotes() throws Exception
              UserDao userDao = (UserDao) applicationContext.getBean("userDao");
              User user = userDao.login("[email protected]", "password");
              assertNotNull(user);
              ContactService dao = (ContactService) applicationContext.getBean("contactService");
              List<ContactNote> contactNoteList =
                   dao.getContactNotes(user.getSessionId(), 1276L);
              for (ContactNote note : contactNoteList)
                   System.out.println(note.getContactNoteId() + " " + note.getNote());
    Results of Test
    [TopLink Fine]: 2007.10.02 08:50:30.988--ClientSession(7339385)--Connection(6964063)--Thread(Thread[main,5,mai
    n])--SELECT CONTACTID, CNTIME, CNNOTE, CNDATE, CNSALMNUM FROM CRMLIB.CONTNOTEP WHERE (CONTACTID = CAST (? AS B
    IGINT ))
         bind => [1276]
    1276 Jason requested to get Sinclair gift card "backs" because they have so many returned/used gift cards
    1276 Jason requested to get Sinclair gift card "backs" because they have so many returned/used gift cardsThanks for any help that can be provided. This has me stumped.
    R. Grimes
    Message was edited by:
    rdgrimes

    I was able to resolve this situation by splitting the ContactNote entity in two: ContactNoteId and ContactNote. I had combined them because it seemed kind of silly to have the id, date, time in the ContactNoteID entity, while the ContactNote entity just had two fields beyond the embedded id.
    R. Grimes

Maybe you are looking for

  • Hexidecimal Non-Allowed Characters in a Unicode System

    We have a function module that we've written to replace non-permitted characters with a space in transfer rules.  We see a lot of invisible hexidecimal characters coming in free form text fields.  This work great for English.  However, we have a Unic

  • Hi guys.......pl. help me out .

    New to Java and need some help in solving the following problem. implement two synchronization routines. The first is a spinning barrier using the two-gate method. The second is a queuing event using Java built-in monitors. Basically need two java fi

  • Apps only partially downloaded, blank faces, cannot open, cannot delete

    Apps only partially downloaded, blank face, cannot open, cannot delete

  • Problem: Malware/Spyware Ad on webpages

    Problem with malware and/or spyware. Just a few days ago i have notice that when i visit youtube and google, a "Ad banner" (Flash) open on the top of the window. I use chrome and safari and in both of them i get the same problem. So i want to know if

  • P505-S8980 not uploading to MP3 player in stereo

    I have been using a Sansa MP3 player since before having this computer. It was uploading in Stereo until I attempted to us a ion Profile LP turntable to transfer LP's to MP3 AND CD formats. ion uses i-tunes and it did something to my sound system whe