What is a SessionFactory? Is it a Thread-Safe Object

SessionFactory is Hibernate’s concept of a single datastore and is threadsafe so that many threads can access it concurrently and request for sessions and immutable cache of compiled mappings for a single database. A SessionFactory is usually only built once at startup. SessionFactory should be wrapped in some kind of singleton so that it can … Read more

How will you Configure Hibernate

The configuration files hibernate.cfg.xml (or hibernate.properties) and mapping files *.hbm.xml are used by the Configuration class to create (i.e. configure and bootstraphibernate) the SessionFactory, which in turn creates the Session instances. Session instances are the primary interface for the persistence service.hibernate.cfg.xml (alternatively can use hibernate.properties): These two files are used to configure the hibernate sevice … Read more