aspose file tools
The moose likes Object Relational Mapping and the fly likes redundant execution of connection code Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "redundant execution of connection code" Watch "redundant execution of connection code" New topic
Author

redundant execution of connection code

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
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.


Thanks
Vipul Kumar
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You will need to close your connection after you use it.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
Thanks Hebert.

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

Thanks vipul kumar.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: redundant execution of connection code
 
Similar Threads
No TransactionManagerLookup specified Exception
Help need in Configuration of Hibernate
Problem in Initializing SessionFactory
having two hibernate.cfg.xml on the same project
Data access ny multiple dao