Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Why my Repository method is null?

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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...
 
Master Rancher
Posts: 4663
49
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Date was the problem. It got date as null and program returned the target null exception.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic