Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes EntityNotFoundException in junit with jpa-hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "EntityNotFoundException in junit with jpa-hibernate" Watch "EntityNotFoundException in junit with jpa-hibernate" New topic
Author

EntityNotFoundException in junit with jpa-hibernate

manish ghildiyal
Ranch Hand

Joined: Jan 12, 2013
Posts: 136
Hi,

I am facing an issue while running a junit.
I have an entity A which contains another entity B.
In my business logic component I get A's instance from data base using spring data API. I call its getB() method which gets me B's reference.
But when I call a method on B's reference I get EntityNotFoundException with message also stating the id for which B was not found.
I am not able to understand why does getB() returns B and then I get EntityNotFoundException.
Secondly, in DB I can see B for the id, then why do I get EntityNotFoundException?

Manish
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: EntityNotFoundException in junit with jpa-hibernate
 
It's not a secret anymore!