May 10, 2017
Nadeem back with Suneel Darshan’s Ek Haseena Thi Ek Deewana Tha..
May 09, 2017
Urvashi Dholakia learns horse-riding for Chandrakanta..
Urvashi Dholakia, who played the iconic role of Komolika Basu in 'Kasautii Zindagii Kay' will be playing an antagonist in Ekta Kapoor’s upcoming show Chandrakanta.
She is playing a fearless, ambitious queen Iravati in the show, and is
required to ride a horse. To get into the skin of the character, she
went the extra mile and underwent extensive training in horse riding.
May 07, 2017
Hibernate Tutorial & Interview Questions And Answers
What is Hibernate?
Hibernate is an ORM tool and is used in the data layer of an application. It implements JPA (Java Persistence API), which is a set of standards that have been prescribed for any persistence implementation.
Hibernate is an ORM tool and is used in the data layer of an application. It implements JPA (Java Persistence API), which is a set of standards that have been prescribed for any persistence implementation.
#Part 8: Hibernate Interview Questions
Should all the mapping files of hibernate have .hbm.xml extension to work properly?
No, having .hbm.xml extension is a convention and not a requirement for hibernate mapping file names. We can have any extension for these mapping files.
No, having .hbm.xml extension is a convention and not a requirement for hibernate mapping file names. We can have any extension for these mapping files.
#Part 7: Hibernate Interview Questions ( N+1 problem)
What is N+1 SELECT problem in Hibernate? How to identify and resolve it?
The N+1 query problem happens when the data access framework executed N additional SQL statements to fetch the same data that could have been retrieved when executing the primary SQL query.
This N+1 query problem is not specific to JPA or Hibernate, it can be triggered using any data access technology, even with plain SQL.
The N+1 query problem happens when the data access framework executed N additional SQL statements to fetch the same data that could have been retrieved when executing the primary SQL query.
This N+1 query problem is not specific to JPA or Hibernate, it can be triggered using any data access technology, even with plain SQL.
May 06, 2017
#Part 6: Hibernate Interview Questions
What is the purpose of Session.beginTransaction()?
Hibernate keeps a log of every data exchange with the help of a transaction. Thereon, in case a new exchange of date is about to get initiated, the function Session.beginTransaction is executed in order to begin the transaction.
Hibernate keeps a log of every data exchange with the help of a transaction. Thereon, in case a new exchange of date is about to get initiated, the function Session.beginTransaction is executed in order to begin the transaction.
#Part 5: Hibernate Interview Questions (Composite and Derived Identifiers)
Composite Identifiers
Hibernate also allows us to define composite identifiers. FYI, a composite id is represented by a primary key class with one or more persistent attributes.
Here are the conditions which a primary class need to fulfil:
Hibernate also allows us to define composite identifiers. FYI, a composite id is represented by a primary key class with one or more persistent attributes.
Here are the conditions which a primary class need to fulfil:
- It should be defined using @EmbeddedId or @IdClass annotations
- It should be public, serializable and have a public no-arg constructor
- It should implement equals() and hashCode() methods
- The class's attributes can be basic, composite or ManyToOne while avoiding collections and OneToOne attributes.
#Part 4: Hibernate Interview Questions (Identifiers in Hibernate-JPA)
Generated Identifiers and Hibernate GeneratedValue Strategies
Hibernate provides a couple of generation strategies to generate a primary key in the database table. We can access the strategy with the help of @GeneratedValue annotation.
Hibernate provides a couple of generation strategies to generate a primary key in the database table. We can access the strategy with the help of @GeneratedValue annotation.
May 05, 2017
#Part 3: Hibernate Interview Questions (Mapping Relations)
How to achieve mapping in Hibernate?
Association mappings are one of the key features of Hibernate. It supports the same associations as the relational database model. We can map each of the below associations as a uni or bidirectional association.
Association mappings are one of the key features of Hibernate. It supports the same associations as the relational database model. We can map each of the below associations as a uni or bidirectional association.
- One-to-One associations
- Many-to-One associations
- Many-to-Many associations
#Part 2: Hibernate Interview Questions
What is the difference between save() , persist() and saveOrUpdate methods of session object?
- save() can only INSERT records but saveOrUpdate() can either INSERT or UPDATE records.
- session.save() saves the object and returns the id of the instance, whereas persist do not return anything after saving the instance. The return type of save() is a Serializable object, while return type of persist() method is void.
- persist() method guarantees that it will not execute an INSERT statement if it is called outside of transaction boundaries. save() method does not guarantee the same, it returns an identifier, and if an INSERT has to be executed to get the identifier (like "identity" generator), this INSERT happens immediately, no matter if you are inside or outside of a transaction.
- get() returns null if no data is present, whereas load throws ObjectNotFoundException exception in such case.
- get() always hits the database, whereas load() method doesn't hit the database.
- get() returns actual object, whereas load() return proxy without hitting the database unless required.
#Part 1: Hibernate Interview Questions
What is an ORM tool?
Object-relational mapping (ORM) is a technique that convert the data between relational databases and object oriented programming languages such as Java, C# etc. An ORM tool helps in simplifying data creation, manipulation, and access. It internally uses the Java API to interact with the databases.
Object-relational mapping (ORM) is a technique that convert the data between relational databases and object oriented programming languages such as Java, C# etc. An ORM tool helps in simplifying data creation, manipulation, and access. It internally uses the Java API to interact with the databases.
May 04, 2017
Subscribe to:
Posts (Atom)



