CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Error doing a deleteorder method - java ee

  1. #1
    Join Date
    Dec 2018

    Post Error doing a deleteorder method - java ee

    I need to do a deleteorder method, my idea is to compare all the books that the shop has with the books that are in the order, and then increase the quantity in the stock and remove the order.

    public void deleteOrder(Customer customer, long idOrder){
        for (int i=0; i<=customer.getOrders().size(); i++){
                for(int j=0; j<=SessionMB.getBooks().size(); j++){ #here is the error  
    #### in sessionmb.java
    public List<Books> getBooks(){
        return listBooks.allBooks();
    #### in listbooks.java
    public List<Books> allBooks(){
        TypedQuery<Books> query=em.createQuery("SELECT m FROM books m", books.class);
        return query.getResultList();
    #### in other .java
    public void incStock(int quantity) {
        stock += quantity;
    Last edited by Arjay; December 30th, 2018 at 01:54 PM. Reason: Fixed up closing code tag

  2. #2
    Arjay's Avatar
    Arjay is online now Moderator / MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Error doing a deleteorder method - java ee

    A couple things:
    1) the for loop should use i< rather than i<= (i<= will cause an out of bounds index error)
    2) has SessionMB been initialized?

  3. #3
    Join Date
    Jun 1999
    Eastern Florida

    Re: Error doing a deleteorder method - java ee

    #here is the error
    Can you copy the full text of the error message and paste it here?

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)