Hibernate Interview Questions And Answers

Totel:102 Click: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Hibernate Interview Questions And Answers

Page 1

Hibernate provide key features of it thats why it is good to use hibernate.

Performance: Hibernate can save your time and efforts, and it can let you achieve some performance gains that you could hardly ever achieve by hand-coding.

Portable: Application portability is a key feature in Hibernate it allows developers to port applications to almost all SQL databases. data query and retrieval is possible with hibernate.

Set of objects: Hibernate is set of objects we dont need to learn SQL ,here we can treat table as object. In case of JDBC we need to learn SQL.

Fast development: Development fast in case of Hibernate because you dont need to write queries. 
Get benefit of Cache: Hibernate support 2  level of cache. First level and 2nd level. So you can store your data into Cache for better performance. In case of JDBC you need to implement your java cache.

Open source code :- As open source so no need to pay.

@Entity :-This annotation is used to make a entity (model) class. The annotation in javax.persistence.Entity class. 
@Table:-Used to map table name with POJO
@Id :-Is used to make  primary key column.Table must have a primary key without primary key we cant map . 
@Column :-map column name with java POJO  property 


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

public class BorrowerPersonDetail  {

	private String borrowerPersonRefId;
	private String borrowerRefId;

public String getBorrowerPersonRefId() {
		return this.borrowerPersonRefId;

	public void setBorrowerPersonRefId(String borrowerPersonRefId) {
			this.borrowerPersonRefId = borrowerPersonRefId;
public String getBorrowerRefId() {
		return this.borrowerRefId;

	public void setBorrowerRefId(String borrowerRefId) {
			this.borrowerRefId = borrowerRefId;

Here we had created a POJO class named BorrowerPersonDetail to map is with table named BORROWER_PERSON_DETAILS .
This having two columns 1.BORROWER_PERSON_REF_ID is primary key 
We are making there two columns with borrowerPersonRefId and borrowerRefId 

The org.springframework.orm.hibernate.HibernateTemplate class simplifies Hibernate data access code, and converts checked HibernateExceptions into unchecked DataAccessExceptions, following the org.springframework.dao exception hierarchy. Uses the same SQLExceptionTranslator mechanism as JdbcTemplate. 
The central method is execute(), supporting Hibernate access code implementing the HibernateCallback interface. It provides Hibernate Session handling such that neither the HibernateCallback implementation nor the calling code needs to explicitly care about retrieving/closing Hibernate Sessions, or handling Session lifecycle exceptions.

The settings of the XML configuration file will override the settings used in the properties.

There are three types of instance states in Hibernate:
    * Transient :-The instance is not associated with any persistence context
    * Persistent :-The instance is associated with a persistence context
    * Detached -:The instance was associated with a persistence context which has been closed  currently not associated.

Goto Page:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Hibernate Objective Questions And Answers

Hibernate Objective Questions And Answers

Hibernate Interview Questions And Answers

Hibernate Subjective Questions And Answers

R4R,Hibernate Objective fresher and experienced, Hibernate Subjective fresher and experienced ,Hibernate Interview Questions And Answers,Hibernate fresher and experienced,Hibernate Interview fresher and experienced ,Hibernate Questions fresher and experienced,Hibernate Answers fresher and experienced