Series: Subject: Topic:

Hibernate Interview Questions

Showing Questions 1 - 20 of 49 Questions
First | Prev | | Next | Last Page
Sort by: 

Store images using hibernate

Asked By: cmouli2502 | Asked On: Sep 16th, 2011

How do you store a image in Oracle using hibernate ?

Answered by: Suresh on: Oct 26th, 2013

We need follow procedure to insert image file in to db s/w.

convert image file----->byte[]------>java.sql.blob obj--------->Hb session obj-------->jdbc driver---------->insert in db table value

Answered by: Amit jatav on: Sep 12th, 2013

We can use byte[] type field in json. It absorbe base64 encode string of image. which is directly save and retrive from db by hibernate easily.

What is the difference between and merge and update

Asked By: rajneeshg | Asked On: Jul 12th, 2007

Star Read Best Answer

Editorial / Best Answer

Answered by: promisingram

View all answers by promisingram

Member Since Oct-2008 | Answered On : Oct 19th, 2008

Use update() if you are sure that the session does not contain an already persistent instance with the same identifier, and merge() if you want to merge your modifications at any time without consideration of the state of the session. In other words, update() is usually the first method you would call in a fresh session, ensuring that reattachment of your detached instances is the first operation that is executed.

Answered by: amit on: Jan 29th, 2013

suppose you have detached object (means after closing session persistence object becomes detached object) and you have done some changes in this object with help of setter method now you created new ...

Answered by: Rajani on: Oct 20th, 2011

In Hibernate session can maintain only one object in persistent state with same id number. while converting a detached object into persistent,if already that session has a persistent object with the s...

What is the use of cascade in hbm file?

Asked By: ravi | Asked On: Apr 11th, 2007

Star Read Best Answer

Editorial / Best Answer

Answered by: anupsadhwani60

View all answers by anupsadhwani60

Member Since Sep-2007 | Answered On : Sep 16th, 2007

1) cascade="none", the default, tells Hibernate to ignore the association.
2) cascade="save-update" tells Hibernate to navigate the association when the
transaction is committed and when an object is passed to save() or
update() and save newly instantiated transient instances and persist changes to
detached instances.
3) cascade="delete" tells Hibernate to navigate the association and delete persistent
instances when an object is passed to delete().
4) cascade="all" means to cascade both save-update and delete, as well as
calls to evict and lock.
5) cascade="all-delete-orphan" means the same as cascade="all" but, in addition,
Hibernate deletes any persistent entity instance that has been removed
(dereferenced) from the association (for example, from a collection).
6) cascade="delete-orphan" Hibernate will delete any persistent entity
instance that has been removed (dereferenced) from the association (for
example, from a collection).

Answered by: venkat on: Jan 22nd, 2013

Using cascade property we can ensure relationship with parent to child

Answered by: harikishanrao on: Dec 1st, 2010

Whenever we have a parent child relation ship, if parent record is changed then child record should also be changed. Primary key must be reflected in the child key

What is the latest version of hibernate using in current industry?

Asked By: enjoy | Asked On: Jan 30th, 2007

Answered by: kalyani on: Jan 9th, 2013


Answered by: koti143 on: Sep 7th, 2012

3.6 is the current version but while executing an application you wont get log messages like in Hibernate 3.2

What is the main advantage of using the hibernate than using the SQL

Asked By: davis | Asked On: Oct 19th, 2006

Answered by: ABHAY RAI on: Aug 25th, 2012

Hibernate provide object oriented functionality and hibernate easily migrate different database without any query changes.

Answered by: Ayaz Roomy on: Apr 27th, 2012

- Hibernate is something which is totally based on ObjectOrientedProgramming concept.where as SQL is based on Querys .But Hibernate also uses sql queries but it is using Objects to handle the res...

How to create primary key using hibernate?

Asked By: satyanarayana | Asked On: Oct 23rd, 2006

Answered by: vimala on: Jul 13th, 2012

In hibernate mapping file

  1. .hbm.xml add <id> under <class>
  2. <class name="class name" table="table name">
  3.    <id name="pojo variable name" column="table column name"/>//primarykey mapping
  4.    <property name="pojo variable name" column="table column name/>//non-primarykey mapping
  5. </class>

Answered by: mani.sivapuram on: Feb 21st, 2011

First you have to do is when you are creating table itself you have to give the primary key for any one of the column and then in the hibernate take hbm file  in that there is a tag like <id&g...

Hibernate JDBC driver

Asked By: itsvenuhere | Asked On: May 6th, 2010

What type of JDBC driver is used in hibernate?

Answered by: nabi_alam on: Mar 30th, 2012

It depends on the Database what we are using.According to the database we use corresponding Driver.

When would you use hibernate and spring JDBC template ?

Asked By: ekbotekomal17 | Asked On: Nov 4th, 2011

Answered by: sampra on: Mar 19th, 2012

Spring jdbc and hibernate are working in same way depends what technologies we are using

Q1: what is the difference between hibernate and ejb 2.1? Q2: which one, among ejb 2.1 and hibernate, is better?Explain with reason.Q3: when to use ejb 2.1 and when to use hibernate? Explain with scenarios....

Asked By: Kumar | Asked On: Jan 27th, 2007

Answered by: srinivasaraobora on: Sep 20th, 2011

Advantages of Hibernate Over EJB Entity bean is also used for object oriented view. It needs lot of things to configure for make it possible and Lot of coding need for it. After all these performance ...

Answered by: sony v george on: Apr 4th, 2007

Basically Ejb and Hibenate is enterly different one But having realtion with Entitybean in Ejb and Hibernate. Entity bean is also used for object orientd view . It need lot things to configures fo mak...

How do we create new table apart from mapping with existing table ?

Asked By: markantony | Asked On: May 12th, 2011

Answered by: CrackHead on: Aug 8th, 2011

Hibernate automatically creates new tables if there are corresponding POJOs. If you know how to write/read to/from an existing table using Hibernate, then you can easily create a table. Step#1: Creat...

What is database persistence?How well it is implemented in hibernate

Asked By: donna | Asked On: Mar 27th, 2007

Answered by: mani.sivapuram on: Feb 14th, 2011

There are mainly three states in hibernate a) Transient state b) Persistant state c) Detatched state Take the employee object place the data in that object like usename, password, empid. Now th...

Answered by: prasadkuppa on: Apr 23rd, 2008

Preserving the data inside a database is database persistence. Persistence is once of the fundamental concepts of application developement. There are many alternatives to implement persistence. Object...

What is the advantage of hibernate over JDBC?

Asked By: kounteya | Asked On: Nov 20th, 2006

Answered by: Ballu Ashok on: Jan 21st, 2010

Hibernate Advantages:Productivity:                Improves the productivity by eliminating the JDBC tedious code.  ...

Answered by: imam.tunduru on: Sep 9th, 2009

Advantages OF Hibernate: - First of all will provide business entity form of representation of DB tables. - Hibernate provides an interface to develop our application code which is not specific to an...

How jpa and hibernate are related as per ejb 3 specifications?

Asked By: sunils | Asked On: Oct 17th, 2006

Answered by: krishna_kanth83 on: May 29th, 2008

first things first ..i have just seen ppl venting thier personal grudge over java / jpa or whatever over this forum.suns official sacceptence that jpa is a failure. please lets keep it for the ...

Answered by: Sri on: Oct 12th, 2007

JPA is official acceptance from SUN about its failure on EJB. It has to abandon its EJB model to go to ORM model. Finally, Sun  should provide developers some tools to migrate Java programs to .net easily with out pain

Why do you need orm tools like hibernate?

Asked By: sunils | Asked On: Oct 17th, 2006

Answered by: mani.sivapuram on: Feb 14th, 2011

since we want to reduce burden on the developer so for big projects if any maintaince is requered then problem finding and bug fixing is easy in case of hibernate.I can obey with one thing it we need ...

Answered by: meetaskjain on: Mar 8th, 2010

Hibernate allows the application developer to concentrate on the business logic instead of writing complex SQLs. Aprt from this hibernate would take care of the database connections and managing conne...


Asked By: swap_j2ee | Asked On: Sep 18th, 2009

What are pojos?How pojos are created & used in hibernate?

Answered by: teddythms on: Mar 24th, 2011

You can use the Hibernate Mapping Files and POJOs from a Database wizard to generate files for you. The wizard can generate a POJO and a corresponding mapping file for each table that you select i...


Asked By: radhika rasne | Asked On: Mar 14th, 2010

What does hibernate mean? How it's work?

Answered by: teddythms on: Mar 24th, 2011

Hibernate is a framework, which enables your applications to interact with DBs using Object Relational Mapping.Hibernate provides a solution to map database tables to a class. It copies the database d...

Hibernate error

Asked By: teddythms | Asked On: Mar 24th, 2011

Org.Hibernate.Hibernateexception: could not instantiate querytranslatorfactory: org.Hibernate.Hql.Classic.Classicquerytransactionfactory at org.Hibernate.Cfg.Settingsfactory.Createquerytranslatorfactory(settingsfactory.Java:391) at org.Hibernate.Cfg.Settingsfactory.Buildsettings(settingsfactory.Java:222) at...

What is component mapping in hibernate?

Asked By: sunils | Asked On: Oct 17th, 2006

Answered by: mani.sivapuram on: Feb 21st, 2011

I will explain one realtime scenario here.Consider one Address class as given belowpublic class Address{private Integer doorNo;private String street;//provide setters and getters for above properties}...

Answered by: Rajavel.B on: Nov 6th, 2006

A component is a contained object that is persisted as a value type ,not an entity class person{private Name name;public Name getName(){ return name;}public void setName(Name name)...

What is the difference between hibernate and spring

Asked By: HARSHAL | Asked On: Apr 2nd, 2007

Answered by: mani.sivapuram on: Feb 21st, 2011

Hibernate is used to interact with database.i.e if we want to save some data then we use hibernate or jdbc or some other tools available in the market.But it is not possible for struts or spring to st...

Answered by: srini on: May 3rd, 2007

Hibernate is ORM tool used for data persistency.Spring is a framework for enterprise applications with default APIs for presentation, middle tiers and presistence layers and allows to integrate with ...

What is the difference between hibernate and spring JDBC template? List any advantages and disadvantages

Asked By: kasim | Asked On: May 26th, 2007

Answered by: mani.sivapuram on: Feb 21st, 2011

JdbcTemplate is configured in spring configuration file like first datasource object is created and then datasource object is given to jdbcTemplate using setter method and jdbcTemplate object is given...

Answered by: alkumar2000 on: Aug 17th, 2008

Spring provides support for both hibernate and JDBC.It provides template classes which contains all common code.But JDBC as we all know is not an ORM tool it does not represent rows as objects whereas Hibernate does that.

First | Prev | | Next | Last Page





twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.