Hibernate Architecture

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;" trbidi&equals;"on"><b>Hibernate Architecture and API-<&sol;b><&sol;p>&NewLine;<p>In this Hibernate Architecture tutorial we include all components&period; Hibernate Architecture is layered with many objects such persistent object&comma; session factory&comma; transaction factory&comma; connection factory&comma; session&comma; transaction etc&period; Let see below diagram describing some basic hibernate functionality&period; <&sol;p>&NewLine;<div align&equals;'center' id&equals;"ads-id"><&sol;div>&NewLine;<p><b><u><br &sol;>&NewLine;<&sol;u><&sol;b><b><u><&sol;u><&sol;b><br &sol;>&NewLine;<b><u><br &sol;>&NewLine;<&sol;u><&sol;b><&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img border&equals;"0" height&equals;"416" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2017&sol;04&sol;my-hibernate&period;jpg" width&equals;"640" &sol;><&sol;div>&NewLine;<p><b><u><br &sol;>&NewLine;<&sol;u><&sol;b><br &sol;>&NewLine;<b><u><br &sol;>&NewLine;<&sol;u><&sol;b><&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img border&equals;"0" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2017&sol;04&sol;hibernate-503x175&period;jpg" &sol;><&sol;div>&NewLine;<p>&NewLine;<b>Configuration<&sol;b><br &sol;>&NewLine;It represents a configuration or properties file for Hibernate&period; The Configuration object is usually created once during application initialization&period; The Configuration object reads and establishes the properties Hibernate uses to get connected to a database and configure itself for work&period; A Configuration object is used to create a SessionFactory and then typically is discarded&period;<&sol;p>&NewLine;<p><b>SessionFactory&nbsp&semi;<&sol;b><br &sol;>&NewLine;The SessionFactory is created from a Configuration object&comma; and as its name implies it is a factory for Session objects&period;The SessionFactory is an expensive object to create&period; It&comma; like the Configuration object&comma; is usually created during application start up&period; However&comma; unlike the Configuration object&comma; It should be created once and kept for later use&period;<&sol;p>&NewLine;<p>The SessionFactory object is used by all the threads of an application&period; It is a thread safe object&period; One SessionFactory object is created per database&period; Multiple SessionFactory objects &lpar;each requiring a separate configuration&rpar; are created when connecting to multiple databases&period; The SessionFactory can also provide caching of persistent objects&period; -Dinesh<&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img border&equals;"0" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2017&sol;04&sol;hib2-493x176&period;jpg" &sol;><&sol;div>&NewLine;<p>&NewLine;<b>Session<&sol;b><br &sol;>&NewLine;Session objects provide the main interface to accomplish work with the database&period; Persistent objects are saved and retrieved through a Session object&period; A Session object is lightweight and inexpensive to create&period; A Session object does the work of getting a physical connection to the database&period; Session objects maintain a cache for a single application thread &lpar;request&rpar;&period;<&sol;p>&NewLine;<p>Session objects are not thread safe&period; Therefore&comma; session objects should not be kept open for a long time&period;Applications create and destroy these as needed&period; Typically&comma; they are created to complete a single unit of work&comma; but may span many units&period; -Dinesh<&sol;p>&NewLine;<p><b>Transaction&nbsp&semi;<&sol;b><br &sol;>&NewLine;it represents unit of works&period;<&sol;p>&NewLine;<p><b>Query and Criteria<&sol;b><br &sol;>&NewLine;These objects are used to retrieve &lpar;and recreate&rpar; persistent objects&period;<&sol;p>&NewLine;<h3>Next Chapter 3 &&num;8211&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;p&sol;chapter-3-setting-up-hibernate-to&period;html">Setting Up Hibernate To Eclipse<&sol;a><&sol;h3>&NewLine;<h3 style&equals;"text-align&colon; center&semi;">&nbsp&semi;&lt&semi;&lt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;2012&sol;03&sol;hibernate-3-on-baby-steps&period;html" style&equals;"line-height&colon; 14px&semi;">Previous Chapter 1<&sol;a>&lt&semi;&lt&semi; &nbsp&semi;&nbsp&semi; &gt&semi;&gt&semi;N<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;p&sol;chapter-3-setting-up-hibernate-to&period;html" style&equals;"line-height&colon; 14px&semi;">ext Chapter 3<&sol;a>&gt&semi;&gt&semi;<&sol;h3>&NewLine;<div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;