• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

redundant execution of connection code

 
vipul bondugula
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am a newbie to Hibernate. I successfully completed persisting data into a table. Now i am reviewig on the code i have written.

I have noticed the connection code is excuting repeatedly..How to avoid that..
I am posting my code.



With this code every time Class Loader have to load the resource and parse the xml files..How to avoid ....In real-time how the process will be...?


Thanks & Regards,
Vipul Kumar.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to close your connection after you use it.
 
vipul bondugula
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Hebert.

So Everytime wherever i open connction i need to close SessionFactory ,right?

Thanks vipul kumar.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vipul bondugula wrote:Thanks Hebert.

So Everytime wherever i open connction i need to close SessionFactory ,right?

Thanks vipul kumar.


That is right.

If you creat a web app you could let the containner take care of it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic