heartin's blog

Hibernate Questions on Important Differences for Self Assessment

These are some of the commonly asked questions to check if you know the differences between important concepts or APIs in Hibernate. This may contain beginner to advanced level questions.

 

  1. Differentiate between entities and value types in Hibernate.

  2. What is the difference between save() and persist() methods in Hibernate?

  3. What is the difference between get and load methods in hibernate?

Different Ways to Configure in Hibernate 4.3

Before working with hibernate in your code, you will need to configure Hibernate with information regarding your database such as host, port, credentials etc. You also need to create mappings that tell hibernate how to map the state of a Java entity to the columns of its corresponding table.

We can configure various hibernate features either through annotations or through xml files (hbm files). Preferred approach currently is annotations.

 

You can configure Hibernate mainly in three ways:

Hibernate Essentials Questions for Self Assessment

This is a list of basic questions from Hibernate which you can use to check your understanding or even prepare for interviews. You may use the parent chapter, other chapters or hibernate or the forum to discuss more on these questions.

 

  1. What is a framework?

  2. What do you mean by CRUD?

  3. What is Hibernate? What are the advantages of using Hibernate?

  4. What is Java Persistence API (JPA)?

[Problems] Summary of Problems on Arrays

  1. Find all pairs of integers within an array that sum to a specified value:

    • Approach 1: Using hash table (more time efficient)

    • Approach 2: Through sorting (more space efficient)

  2. Given an M x N matrix, if an element is 0, its entire row and column in the matrix should be set to 0.

  3. You are given a 2-Dimensional array (matrix) and a scale factor. You need to write a method to scale the 2D array according to the scale factor.

[Problems] Summary of Problems on Sorting and Searching

  1. Merge two sorted arrays A and B in sorted order. A has enough locations in the end to hold the elements of B.

    • No extra buffer should be used.

    • Every element should be shifted from its current position in A, at most 1 time.

    • Hint:

      • Start filling from the end of A.

  2. Sort an array of Strings. All anagrams should be next to each other.

    • Hint:

      • Approach 1: Modify the comparator to indicate that two anagrams are equal, and then sort.

Pages

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) Arrays (1) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (55) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (9) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (11) Java Programmer 2 (7) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)