• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity with id 0

 
Grzegorz Novvak
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
When I try to find an entity using Entity Manager with id = 0 I get an Exception which says that the entity with id = 0 can't be found. The entity of course exist in the database.
The id property in my bean looks like this:


I'm using JBoss 4.2.2 with PostgreSQL.

Is it a hibernate issue or am I missing something?
 
Ramon Anger
Ranch Hand
Posts: 56
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Grzegorz,

may be Hibernate interpretes 0 as uninitialized or null. What happens if you change the type of id from Integer to Long?

Cheers,
Ramon
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramon Anger wrote:
may be Hibernate interpretes 0 as uninitialized or null.


Hibernate doesn't do this. If you turn on show SQL what SQL does Hibernate use?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic