• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Why my Repository method is null?

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On my service create invoiceProduct I have the above code:      









I cannot undrestand why is null the result of
           Retrieval existRetrieval=retrievalRepository.findByProductAndShelfAndDate(invoiceProduct.getProduct(),invoiceProduct.getShelf(), invoice.getDate());

invoiceProduct is a list ,

My JSON on postman is this...
{
       .....
        "invoiceProductDTOTotalList" : [
                {
                "shelfId" : "35",
                "productId" : "adada",
                "quantity": 10
                }

        ]


my problem is about existRetrieval cannot find an existing retrieval...
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the connection between all these bits of code?

Have you looked in the database to see what data is being stored there?
 
Eleni Pap
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The data saved all ok, but I want if I had an already an already entity  retrieval to change some of its data.
For example if
  Retrieval existRetrieval=retrievalRepository.findByProductAndShelfAndDate(invoiceProduct.getProduct(),invoiceProduct.getShelf(), invoice.getDate());  (!=null)
...to  make changes.

Although I have already the data:
 invoiceProduct.setProduct(product);
 invoiceProduct.setShelf(shelf);

when existRetrieval start, find that product is null, shelf is null, as a result, cannot be not null the exist retrieval.
 
Eleni Pap
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Date was the problem. It got date as null and program returned the target null exception.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic