Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get session of one class in another class in Hibernate?

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am making an application in which I am saving Image in database so I am using method


instead of createBlob() (it is deperacted)

But I am getting Null Pointer Exception this is My DAOImpl class


I am getting Null Pointer Exeception because I am calling from some other class like this


How to get session there?

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kishor Joshi wrote:How to get session there?

That's not required at all!

If you have a Person entity with an instance variable of type byte[] you can simply do as in this example:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic