Hibernate

Hibernate Tutorial for Beginners Learn step by step

<p>This hibernate tutorial provide step by step instructions on using Hibernate&period; Hibernate is popular open source object relational mapping tool for Java platform&period; It provides powerful&comma; ultra-high performance object&sol;relational persistence and query service for Java&period;<&sol;p>&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img class&equals;"alignright" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;03&sol;Hibernate-tutorials&period;png" width&equals;"250" height&equals;"100" border&equals;"0" &sol;><&sol;div>&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div style&equals;"color&colon; blue&semi;"><&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;">Actually Hibernate is much more than ORM Tool &lpar;Object &&num;8211&semi; Relational Mapping&rpar; because today its provide lots of features in the persistence data layer&period;<&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;"><&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;"><b>ORM<&sol;b> means <u>Objects to Relational Mapping<&sol;u> i&period;e&period; <u>Java Persistence Objects are mapped to Relational databases<&sol;u> by using ORM tools&period;<&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;"><&sol;div>&NewLine;<h2 style&equals;"color&colon; blue&semi;"><u><b>HIBERNATE<&sol;b><&sol;u><b> &colon;<&sol;b><&sol;h2>&NewLine;<ul style&equals;"text-align&colon; left&semi;">&NewLine;<li style&equals;"background-color&colon; &num;ffe599&semi;">An <b>ORM <&sol;b>Tool<&sol;li>&NewLine;<li style&equals;"background-color&colon; &num;ffe599&semi;">Used in the <b>Data layer<&sol;b> of the applications<&sol;li>&NewLine;<li>Implements <b>JPA<&sol;b><b style&equals;"background-color&colon; &num;ffe599&semi;"> &lpar;<&sol;b>Java Persistence API<b style&equals;"background-color&colon; &num;ffe599&semi;">&rpar; <&sol;b>i&period;e its have set of standards that have been prescribed for any persistence of any implementation need to be satisfied to persistence rules in the java that given minimal change of codes means follow the all rules of persistence in later if any change in the ORM tools with minimum change in the code&period;<b> <&sol;b><&sol;li>&NewLine;<&sol;ul>&NewLine;<h2><i><b style&equals;"color&colon; blue&semi;">Why We Have to Use ORM Tools&quest;<&sol;b><&sol;i><&sol;h2>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;03&sol;hibernate1&period;jpg" width&equals;"400" height&equals;"175" border&equals;"0" &sol;><&sol;div>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><&sol;div>&NewLine;<p>Here there is one problem to object save in to relational database each entity of the object save individually to the database table in the associated columns<b>&period; <&sol;b>It is more times taken and complex in case of lots of user objects to be save into the database table&period;<b><&sol;b><br &sol;>&NewLine;<b><br &sol;>&NewLine;<&sol;b><&sol;p>&NewLine;<div id&equals;"ads-id" align&equals;"center"><&sol;div>&NewLine;<h2><b>When Inserting into database&period;<&sol;b><&sol;h2>&NewLine;<p><b>                        <&sol;b>Object&&num;8217&semi;s Property <b>ID <&sol;b>set to <b>ID <&sol;b>column<&sol;p>&NewLine;<div style&equals;"color&colon; blue&semi;">                        Object&&num;8217&semi;s Property<b> Name <&sol;b>set to <b>Name <&sol;b>Column<&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;">                        Object&&num;8217&semi;s Property<b> Address <&sol;b>set to <b>Address <&sol;b>Column<&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;">                        Object&&num;8217&semi;s Property <b>Phone <&sol;b>set to <b>Phone <&sol;b>Column<&sol;div>&NewLine;<p>Object&&num;8217&semi;s Property <b>Date of Birth<&sol;b> set to <b>DOB <&sol;b>Column<&sol;p>&NewLine;<h2><b>When Fetching Result Set from Database Table&period;<&sol;b><&sol;h2>&NewLine;<p><b>                         <&sol;b>Column <b style&equals;"color&colon; blue&semi;">ID<&sol;b>&&num;8216&semi;s Value set to Object&&num;8217&semi;s <b style&equals;"color&colon; blue&semi;">ID <&sol;b>Property<b style&equals;"color&colon; blue&semi;"> <&sol;b><&sol;p>&NewLine;<div style&equals;"color&colon; blue&semi;"><b style&equals;"color&colon; blue&semi;"><b>                         <&sol;b><&sol;b>Column <b>Name<&sol;b>&&num;8216&semi;s Value set to Object&&num;8217&semi;s <b>Name <&sol;b>Property<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"color&colon; blue&semi;">                         Column <b>Address<&sol;b>&&num;8216&semi;s Value set to Object&&num;8217&semi;s <b>Address <&sol;b>Property<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"color&colon; blue&semi;">                         Column <b>Phone<&sol;b>&&num;8216&semi;s Value set to Object&&num;8217&semi;s <b>Phone <&sol;b>Property<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"color&colon; blue&semi;">                         Column <b>DOB<&sol;b>&&num;8216&semi;s Value set to Object&&num;8217&semi;s <b>Date of Birth <&sol;b>Property<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"color&colon; blue&semi;"><b style&equals;"color&colon; blue&semi;"> <&sol;b><&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><b style&equals;"color&colon; blue&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;03&sol;hibernate2&period;png" width&equals;"400" height&equals;"236" border&equals;"0" &sol;><&sol;b><&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;"><b> <&sol;b><&sol;div>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;03&sol;hibernate3&period;png" width&equals;"400" height&equals;"265" border&equals;"0" &sol;><&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;"><b> <&sol;b><&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<h2 style&equals;"background-color&colon; &num;f2f9fc&semi; border-radius&colon; 3px&semi; border&colon; 1px solid &num;c9e6f2&semi; line-height&colon; 1&period;45&semi; padding&colon; 16px&semi;"><span style&equals;"color&colon; red&semi; font-size&colon; x-large&semi; text-align&colon; center&semi;"><b>Hibernate Tutorial Contents<&sol;b><&sol;span><&sol;h2>&NewLine;<div style&equals;"background-color&colon; &num;f2f9fc&semi; border-radius&colon; 3px&semi; border&colon; 1px solid &num;c9e6f2&semi; line-height&colon; 1&period;45&semi; padding&colon; 16px&semi;">&NewLine;<ol style&equals;"text-align&colon; left&semi;">&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-3-on-baby-steps&sol;"><b>Introduction to Hibernate 3&period;0<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-architecture&sol;"><b>Hibernate Architecture<&sol;b><&sol;a><b> <&sol;b><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;chapter-3-setting-up-hibernate-to&sol;"><b>Setting Up Hibernate<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;chapter-4-writing-first-hibernate&sol;"><b>Writing a First Hibernate Application Using Annotation<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;chapter-5-writing-first-hibernate&sol;"><b>Writing a First Hibernate Application Using Mapping File <&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;chapter-6-understanding-hibernate-or&sol;"><b>Understanding Hibernate O&sol;R Mapping<&sol;b><&sol;a><b> <&sol;b><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;saving-objects-using-hibernate-apis&sol;"><b>Saving Objects using Hibernate APIs<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;using-annotations-vs-configuration&sol;"><b>Using Annotations vs Configuration files<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hbm2ddl-configuration-and-name&sol;"><b>hbm2ddl Configuration and Name Annotations<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;retrieving-objects-using-sessionget&sol;"><b>Retrieving Objects using session&period;get<&sol;b><&sol;a><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-update-query&sol;">Hibernate Update Query<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-delete-query&sol;">Hibernate Delete Query<&sol;a><&sol;b><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;value-types-and-embedding-objects&sol;"><b>Value Types and Embedding Objects<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;saving-collections&sol;"><b>Saving Collections<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;configuring-collections-and-adding-keys&sol;"><b>Configuring Collections and Adding Keys<&sol;b><&sol;a><&sol;li>&NewLine;<li><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;proxy-objects-and-eager-and-lazy-fetch&sol;"><b>Proxy Objects and Eager and Lazy Fetch Types<&sol;b><&sol;a><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-one-to-one-mapping-tutorial&sol;">Hibernate One-To-One Mapping Tutorial<&sol;a><&sol;b><b> <&sol;b><b> <&sol;b><b> <&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-one-to-many-mapping-tutorial&sol;">Hibernate One-To-Many Mapping Tutorial<&sol;a><&sol;b><b> <&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-many-to-one-mapping-tutorial&sol;">Hibernate Many-To-One Mapping Tutorial<&sol;a><&sol;b><b> <&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-many-to-many-mapping-tutorial&sol;">Hibernate Many-To-Many Mapping Tutorial<&sol;a><&sol;b><b> <&sol;b><&sol;li>&NewLine;<li><b> <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;cascadetypes-and-other-things&sol;">CascadeTypes and Other Things<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;implementing-inheritance-in-hibernate&sol;">  Implementing Inheritance in Hibernate &lpar;Single Table Strategy&comma; With Table Per Class Strategy&comma; With Joined Strategy&rpar;<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;crud-operations-using-hibernate-3&sol;">CRUD Operations Using Hibernate 3 &lpar;Annotation and Configuration&rpar;<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;transient-persistent-and-detached&sol;">Transient&comma; Persistent and Detached Objects in Hibernate<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;understanding-state-changes-of-object&sol;">Understanding State Changes of Object in Hibernate<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;introducing-hqlhibernate-query-language&sol;"> Introducing HQL&lpar;Hibernate Query Language&rpar; and the Query Object<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;select-and-pagination-in-hql&sol;">Select and Pagination in HQL<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;understanding-parameter-binding-and-sql&sol;">Understanding Parameter Binding and SQL Injection<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;named-queries&sol;">Named Queries<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;introduction-to-criteria-api&sol;">Introduction to Criteria API<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;understanding-restrictions&sol;">Understanding Restrictions<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;cacheing-in-hibernate-first-level-and&sol;">Cacheing in Hibernate&colon; First Level and Second Level Cache in Hibernate<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;using-query-cache-in-hibernate&sol;">Using Query Cache in Hibernate<&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-batch-processing&lowbar;10&sol;">Hibernate Batch Processing <&sol;a><&sol;b><&sol;li>&NewLine;<&sol;ol>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<p><b>References<&sol;b><&sol;p>&NewLine;<p>This Hibernate tutorial textual implementation of Java Brain Videos&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hql-from-clause-example&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '693'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design Patterns using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago