• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database connection in hibernate

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We specify the Database connection in hibernate.cfg.xml file.

Is this file loaded when we start the server?

Does the application connect to the database only once during startup , or each time we perform the CRUD operations.I mean is there a opening and closing of a database connection each time we perform an operation on the database.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

p hasini wrote:We specify the Database connection in hibernate.cfg.xml file. Is this file loaded when we start the server?


Hibernate does that when initializing.

Does the application connect to the database only once during startup , or each time we perform the CRUD operations.


Normal practice is to use the connection pool provided by the application server.

I mean is there a opening and closing of a database connection each time we perform an operation on the database.


In case of connection pooling connection object (handle) returns to the pool when you close it in your code. You can configure Hibernate to use the connection pooling.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic