how many ways of configuration in hibernate?

1 Like
We can configure application in hibernate in two ways

1) programmatic approach 

2) Declarative approach

1) Programmatic approach:

Programmatic approach we can execute a hibernate application by ”without creating a configuration file”

We can set connection and hibernate properties by calling set property method of configuration class and mappin resources by calling addResurce() method

Configuration conf=new Configuration();

2) Declarative approach:

 Properties file:

We can do connection settings and hibernate settings in properties file but we can’t do name and location of mapping file setting in a properties file

The name and location of the mapping file can be set by calling addResource() method of configuration class.

Hibernate dialet=org.hibernate.dialect.oracle10gdialect.hibernate.show_sql=true.