- Pojo class.
- Hbm.xml file.
- Hibernate configuration . xml file.
- Client class of hibernate.
Pojo class It is an ordinary java class having member variable.the pojo class will be mapped with table and member variable will be mapped with table columns in the process of o-r mapping.this class will used by hibernate client application to developed database independence persistence logic.
Hibernate mapping file(hbm.xml) can becomes hibernate mapping file.but it should be specified as the property value of hibernate this file contains xml enteries to perform o-r mapping and also to specify object level releationship.
Hibernate configuration file In earlier version it was a properties file from hibernate 2.2x it is change if no file is explicitly specified it becomes a hibernate-cfg.xml file as the hibernate configuration file this contain following minimum information
- jdbc driver class name.
- jdbc url.
- database username.
- database password.
- dilect entry point out database.
- name of the mapping file.
Hibernate configuration file information needed to connect to persistent layer and the linked mapping documents. You can either specify the data source name or JDBC details that are required for hibernate to make JDBC connection to the database. The element refers to the mapping document that contains mapping for domain object and hibernate mapping document
Hibernate client application.this can be any java/j2ee components or application who actually wants to develop database independent persistence logic using pojo class and hql.this uses core api of hibernate to activate hibernate software and to load hibernate configuratiobn file and pojo class object from the memory.
In configuration file based approach, “hibernate.cfg.xml” is placed in the classpath, Following Hibernate code can be used in this method.
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();