• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and Javassist

 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have Class A with a one to many relationship with Class B.

When I access Class B from Class A instead of just loading it from the database, it gets returned as class_$$_javassist_5 instead of the normal class. This breaks my reflection.

Any ideas why I'd get the javassist version?
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So apparently the javassist is an artifact of Hibernate's lazy loading. It's the object that gets stuffed in there 'til Hibernate needs to load the object from the DB.

Is there a way to turn off lazy loading for one query? I'm only finding methods to turn it off for the whole app.
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found it. Added a fetch to the query and everything is working now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic