{"id":3787,"date":"2024-01-08T20:48:18","date_gmt":"2024-01-08T20:48:18","guid":{"rendered":"https:\/\/www.juniorjavadeveloper.pl\/?p=3787"},"modified":"2024-01-08T20:48:22","modified_gmt":"2024-01-08T20:48:22","slug":"omg-orm-jpa-hibernate-sessionfactory-entitymanager-jparepository-crudrepository-wyjasnione","status":"publish","type":"post","link":"https:\/\/www.juniorjavadeveloper.pl\/en\/2024\/01\/08\/omg-orm-jpa-hibernate-sessionfactory-entitymanager-jparepository-crudrepository-wyjasnione\/","title":{"rendered":"OMG! ORM, JPA, Hibernate \u2013 SessionFactory, EntityManager, JpaRepository \/ CrudRepository \u2013 explained"},"content":{"rendered":"<p class=\"has-large-font-size wp-block-paragraph\">In this article, I will try to help you navigate the maze of possibilities offered by Hibernate. I will explain where and how to use the title SessionFactory, EntityManager, and JpaRepository\/CrudRepository. People learning Hibernate often come across a sea of possibilities while searching for solutions on the Internet.<\/p>\n\n\n    <style>\r\n        .wpj-jtoc.--jtoc-theme-basic-light.--jtoc-has-custom-styles {\r\n            --jtoc-numeration-suffix: \". \";\n--jtoc-numeration-color: #adadad;\n        }\r\n\r\n            <\/style>\r\n\r\n\r\n\r\n<div id=\"wpj-jtoc\" class=\"wpj-jtoc wpj-jtoc--main --jtoc-the-content --jtoc-theme-basic-light --jtoc-title-align-left --jtoc-toggle-icon --jtoc-toggle-position-right --jtoc-toggle-1 --jtoc-has-numeration --jtoc-has-custom-styles --jtoc-is-unfolded\" >\r\n\r\n    \r\n    <!-- TOC -->\r\n    <div class=\"wpj-jtoc--toc\">\r\n                                <div class=\"wpj-jtoc--header\">\r\n                <div class=\"wpj-jtoc--header-main\">\r\n                                        <div class=\"wpj-jtoc--title\">\r\n                        <span class=\"wpj-jtoc--title-label\">Table of Contents<\/span>\r\n                    <\/div>\r\n                                                                <div class=\"wpj-jtoc--toggle-wrap\">\r\n                                                                                                                    <div class=\"wpj-jtoc--toggle-box\">\r\n                                    <div class=\"wpj-jtoc--toggle\"><\/div>\r\n                                <\/div>\r\n                                                    <\/div>\r\n                                    <\/div>\r\n            <\/div>\r\n                            <div class=\"wpj-jtoc--body\">\r\n                        <nav class=\"wpj-jtoc--nav\">\r\n                <ol class=\"wpj-jtoc--items\"><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#wstep\" title=\"Preface\" data-numeration=\"1\">Preface<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#sposoby-dzialania-z-hibernate-4-rozne\" title=\"Ways to work with Hibernate \u2013 4 different ones\" data-numeration=\"2\">Ways to work with Hibernate \u2013 4 different ones<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#wyjasnienie-podstawowych-elementow\" title=\"Explanation of basic elements\" data-numeration=\"3\">Explanation of basic elements<\/a>\r\n                    <\/div> <ol class=\"wpj-jtoc--items\"><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#czym-jest-hibernate\" title=\"What is Hibernate?\" data-numeration=\"3.1\">What is Hibernate?<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#dlaczego-orm\" title=\"Why ORM?\" data-numeration=\"3.2\">Why ORM?<\/a>\r\n                    <\/div> <\/li><\/ol><\/li><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#jak-uzywac-hibernate\" title=\"How to use Hibernate\" data-numeration=\"4\">How to use Hibernate<\/a>\r\n                    <\/div> <ol class=\"wpj-jtoc--items\"><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#mapowanie-java-na-table-entity\" title=\"Java to TABLE mapping \u2013 @Entity\" data-numeration=\"4.1\">Java to TABLE mapping \u2013 @Entity<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#ktory-ze-sposobow-uzycia-hibernate-byl-pierwszy-odpowiedz-chatgpt\" title=\"Which was the first way to use Hibernate? ChatGPT response\" data-numeration=\"4.2\">Which was the first way to use Hibernate? ChatGPT response<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#native-hibernate-api-sessionfactory\" title=\"Native Hibernate API \u2013 SessionFactory\" data-numeration=\"4.3\">Native Hibernate API \u2013 SessionFactory<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#jpa-standard-api-entitymanager\" title=\"JPA-standard API \u2013 EntityManager\" data-numeration=\"4.4\">JPA-standard API \u2013 EntityManager<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#spring-data-jpa-jparepository-crudrepository\" title=\"Spring Data JPA \u2013 JpaRepository \/ CrudRepository\" data-numeration=\"4.5\">Spring Data JPA \u2013 JpaRepository \/ CrudRepository<\/a>\r\n                    <\/div> <\/li><\/ol><\/li><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#gdzie-uzywac-hibernate\" title=\"Where to use Hibernate\" data-numeration=\"5\">Where to use Hibernate<\/a>\r\n                    <\/div> <ol class=\"wpj-jtoc--items\"><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#native-aplikacje-stand-alone\" title=\"Native \u2013 stand-alone applications\" data-numeration=\"5.1\">Native \u2013 stand-alone applications<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#jpa-standard-aplikacje-java-ee\" title=\"JPA-standard \u2013 Java EE applications\" data-numeration=\"5.2\">JPA-standard \u2013 Java EE applications<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h3\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"3\">\r\n                <a href=\"#spring-data-jpa-aplikacje-dla-spring-framework\" title=\"Spring Data JPA \u2013 applications for Spring Framework\" data-numeration=\"5.3\">Spring Data JPA \u2013 applications for Spring Framework<\/a>\r\n                    <\/div> <\/li><\/ol><\/li><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#czy-ktos-w-ogole-uzywa-hibernate\" title=\"Does anyone use Hibernate at all?\" data-numeration=\"6\">Does anyone use Hibernate at all?<\/a>\r\n                    <\/div> <\/li><li class=\"wpj-jtoc--item --jtoc-h2\">\r\n        <div class=\"wpj-jtoc--item-content\" data-depth=\"2\">\r\n                <a href=\"#podsumowanie\" title=\"Summary\" data-numeration=\"7\">Summary<\/a>\r\n                    <\/div> <\/li><\/ol>            <\/nav>\r\n                    <\/div>\r\n    <\/div>\r\n<\/div>\r\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"wstep\">Preface<\/h2>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">When starting their adventure with Hibernate, many people get lost in the sea of possibilities that Hibernate offers. Let me start by saying that Hibernate is one of the JPA \u2013 Java\/Jakarta Persistence API implementations. Popular JPA implementations: <a href=\"https:\/\/hibernate.org\/\" data-type=\"link\" data-id=\"https:\/\/hibernate.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate<\/a>, <a href=\"https:\/\/eclipse.dev\/eclipselink\/\" data-type=\"link\" data-id=\"https:\/\/eclipse.dev\/eclipselink\/\" target=\"_blank \" rel=\"noreferrer noopener\">EclipseLink<\/a>, <a href=\"https:\/\/openjpa.apache.org\/\" data-type=\"link\" data-id=\"https:\/\/openjpa.apache. org\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenJPA<\/a> and <a href=\"https:\/\/www.datanucleus.org\/\" data-type=\"link\" data-id=\"https :\/\/www.datanucleus.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">DataNucleus<\/a>.<\/p>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Nauk&#281; Hibernate &ndash; jak wi&#281;kszo&#347;&#263; framework&oacute;w &ndash; warto zacz&#261;&#263; od <a href=\"https:\/\/hibernate.org\/\" data-type=\"link\" data-id=\"https:\/\/hibernate.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">oficjalnej dokumentacji<\/a>. Ju&#380; na stronie g&#322;&oacute;wnej widzimy bardzo wymowny banner &ldquo;<strong>More than an ORM, discover the Hibernate galaxy.<\/strong>&rdquo; W sk&#322;ad Hibernate wchodz&#261; np.: Hibernate Search oraz Hibernate Validator (u&#380;ywany w Spring Framework &ndash; Spring MVC).<\/p>\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"sposoby-dzialania-z-hibernate-4-rozne\">Ways to work with Hibernate \u2013 4 different ones<\/h2>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Z oficjalnej dokumentacji, a dok&#322;adnie z cz&#281;&#347;ci &ldquo;<a href=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/quickstart\/html_single\/\" data-type=\"link\" data-id=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/quickstart\/html_single\/\" target=\"_blank\" rel=\"noreferrer noopener\">Getting Started with Hibernate<\/a>&ldquo;, dowiadujemy si&#281;, &#380;e Hibernate mo&#380;na u&#380;ywa&#263; na trzy sposoby, ja dorzuc&#281; czwarty.<\/p>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Getting Started with Hibernate:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-large-font-size\">Using native Hibernate APIs.<\/li>\n\n\n\n<li class=\"has-large-font-size\">Using JPA-standard APIs.<\/li>\n\n\n\n<li class=\"has-large-font-size\">Using Envers.<\/li>\n\n\n\n<li class=\"has-large-font-size\">(I add) Using Spring Data JPA.<\/li>\n<\/ol>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">I will describe each of the above points in detail later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"wyjasnienie-podstawowych-elementow\">Explanation of basic elements<\/h2>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Before we dive into how to use Hibernate, let's explain some basic concepts. I will post technical descriptions and my own interpretation.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote has-large-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">API<\/p>\n<cite>An <strong>application programming interface<\/strong> (<strong>API<\/strong>) is a way for two or more <a href=\"https:\/\/en.wikipedia.org\/wiki\/Computer_program\">computer programs<\/a> to communicate with each other. It is a type of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Software_interface\">software interface<\/a>, offering a service to other pieces of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Software\">software<\/a>. &#377;r&oacute;d&#322;o Wikipedia.<br><br>Moja interpretacja: API, to zbi&oacute;r interfejs&oacute;w programistycznych, kt&oacute;rych cech&#261; jest, to, &#380;e wskazuj&#261;, &#380;e co&#347; mo&#380;na zrobi&#263;, ale nie m&oacute;wi&#261; jak, to zrobi&#263;. Np. JPA &ldquo;m&oacute;wi &#380;e&rdquo; mo&#380;na utrwala&#263; obiekty Java, ale nie wskazuje jak utrwala&#263;, to konkretna implementacja JPA np. Hibernate zawiera kod zapisuj&#261;cy do bazy danych.<\/cite><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote has-large-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">JPA<\/p>\n<cite class=\" translation-block\"><strong>Jakarta Persistence<\/strong> (<strong>JPA<\/strong>; formerly <strong>Java Persistence API<\/strong>) is a <a href=\"https:\/\/en.wikipedia.org\/wiki\/ Jakarta_EE\" target=\"_self\">Jakarta EE<\/a> <a href=\"https:\/\/en.wikipedia.org\/wiki\/Application_programming_interface\" target=\"_self\">application programming interface<\/a> specification that describes the management of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Relational_data_model\" target=\"_self\">relational data<\/a> in enterprise <a href=\"https:\/\/en.wikipedia.org\/ wiki\/Java_(software_platform)\" target=\"_self\">Java<\/a> applications. Source Wikipedia.<br><br>My interpretation: JPA contains a set of annotations that can be used to create a Java class definition that reflects a table in the database - entity, <code>@Entity<\/code>. Provides a set of interfaces with methods for persisting data - <code>EntityManager<\/code>, e.g. the <code>persist()<\/code> method.<\/cite><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote has-large-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">ORM<\/p>\n<cite class=\" translation-block\"><strong>Object\u2013relational mapping<\/strong> (<strong>ORM<\/strong>, <strong>O\/RM<\/strong>, and<strong>O\/R mapping tool<\/strong>) in <a href=\"https:\/\/en.wikipedia.org\/wiki\/Computer_science\" target=\"_self\">computer science<\/a> is a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Computer_programming\" target=\"_self\">programming<\/a> technique for converting data between a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Relational_database\" target=\"_self\">relational database<\/a> and the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Memory_management#HEAP\" target=\"_self\">heap<\/a> of an <a href=\"https:\/\/en.wikipedia.org\/wiki\/ Object-oriented\" target=\"_self\">object-oriented<\/a> programming language. Source Wikipedia.<br><br>My interpretation: The mechanism of mapping Java classes to tables in the database - based on the definition - of the entity, <code>@Entity<\/code> - contained in the Java class.<\/cite><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"czym-jest-hibernate\">What is Hibernate?<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">I'll start with my own interpretation. Hibernate is an ORM that allows you to map Java classes to database tables. Hibernate is one of the JPA implementations. It is worth remembering that Hibernate uses Java JDBC in its implementation. Knowledge of Hibernate does not exempt you from knowledge of JDBC and SQL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Na oficjalnej stronie <a href=\"https:\/\/hibernate.org\/\" data-type=\"link\" data-id=\"https:\/\/hibernate.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate<\/a> przeczytamy: &ldquo;Hibernate ORM. Domain model persistence for relational databases.&rdquo; Na temat <a href=\"https:\/\/hibernate.org\/orm\/\" data-type=\"link\" data-id=\"https:\/\/hibernate.org\/orm\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate ORM<\/a> przeczytamy: &ldquo;Object\/Relational Mapping. Hibernate ORM enables developers to more easily write applications whose data outlives the application process. As an Object\/Relational Mapping (ORM) framework, Hibernate is concerned with data persistence as it applies to relational databases (via JDBC).&rdquo;<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-large-font-size joli-heading jtoc-heading\" id=\"dlaczego-orm\">Why ORM?<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Dlaczego mapujemy klasy Java na tabele w bazie danych? Pierwsze, co przychodzi na my&#347;l, to zapisanie stanu obiekt&oacute;w Java do bazy danych. Jak, to mo&#380;liwe, &#380;e klasy Java mo&#380;na &ldquo;zapisa&#263; w bazie daych&rdquo;? <\/p>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Pierwsza kwestia, to w&#322;a&#347;nie ORM &ndash; wi&#281;cej na ten temat mo&#380;na przeczyta&#263; &ldquo;<a href=\"https:\/\/hibernate.org\/orm\/what-is-an-orm\/\" data-type=\"link\" data-id=\"https:\/\/hibernate.org\/orm\/what-is-an-orm\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate ORM &ndash; What is Object\/Relational Mapping?<\/a>&rdquo; Druga kwestia, to, &#380;e klasy Java s&#261; bardzo podobne do tabel bazodanowych. Jak, to? Klasy Java s&#261; jak tabele? Wyja&#347;nienie poni&#380;ej.<\/p>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Java is an object-oriented language, there are dependencies, associations and connections between classes. However, the databases used by Hibernate ORM are relational databases, there are relationships between tables using a primary key and a foreign key. <\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\">\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class Address {\n    private Long id;\n    private String street;\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE ADDRESSES (\n    ID BIGINT PRIMARY KEY,\n    STREET VARCHAR(255)\n)<\/pre>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Powy&#380;sza klasa Java <code>Address<\/code> oraz tabela bazodanowa  <code>ADDRESSES<\/code> wygl&#261;daj&#261; podobnie, je&#380;eli u&#380;ywaj&#261; &ldquo;prostych typ&oacute;w&rdquo;, sprawa wygl&#261;da inaczej, gdy klasa ma zale&#380;no&#347;ci, a w tabeli pojawia si&#281; relacje.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\">\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class Client {\n    private Long id;\n    private String name;\n    private Address address;\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE CLIENTS (\n    ID BIGINT PRIMARY KEY,\n    NAME VARCHAR(255),\n    ADDRESS_ID BIGINT,\n    CONSTRAINT FK_CLIENTS_ADDRESSES \n        FOREIGN KEY (ADDRESS_ID) \n        REFERENCES ADDRESSES(ID)\n)<\/pre>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">The above Java class <code>Client<\/code> has a dependency on another class <code>Address<\/code>. However, in the database table <code>CLIENTS<\/code> there is a foreign key - <code>FOREIGN KEY<\/code> - to the primary key - <code>PRIMARY KEY<\/code> - in the table <code>ADDRESSES<\/code>. The foreign key is named <code>FK_CLIENTS_ADDRESSES<\/code> and the primary key is for the <code>ID<\/code> column.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\">\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"jak-uzywac-hibernate\">How to use Hibernate<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote has-large-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">Ca&#322;o&#347;&#263; kodu mo&#380;na znale&#378;&#263; na moim koncie GitHub <\/p>\n<cite><a href=\"https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/\" data-type=\"link\" data-id=\"https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples<\/a><\/cite><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote has-large-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">Oficjalna dokumentacja &ndash; Getting Started with Hibernate<\/p>\n<cite><a href=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/quickstart\/html_single\/\" data-type=\"link\" data-id=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/quickstart\/html_single\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/quickstart\/html_single\/<\/a><\/cite><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"mapowanie-java-na-table-entity\">Java to TABLE mapping \u2013 @Entity<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">Configuring Hibernate and how to use it is one thing, but the end result is that we are writing something to a relational database. <strong>We need to map the Java class to database tables, for this we use entities, classes marked with the annotation <\/strong><code>@Entity<\/code><strong>.<\/strong> Such classes constitute a bridge, a template , a definition for Hibernate that will do all the work for us that until now we had to do ourselves using pure JDBC.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Entity\n@Table(name = \"ZOO\")\npublic class Animal {\n    @Id\n    @GeneratedValue\n    private Long id;\n\n    @Column(name = \"BIRTH_DATE\", nullable = false)\n    private Date date;\n    private String name;\n\n    public Animal() {\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"ktory-ze-sposobow-uzycia-hibernate-byl-pierwszy-odpowiedz-chatgpt\">Which was the first way to use Hibernate? ChatGPT response<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Which came first, the egg or the chicken? A similar question can be asked about Hibernate. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote has-large-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">Which was the first way to use Hibernate?<\/p>\n<cite>Hibernate was the first solution as a standalone ORM framework with a native API (2001). The JPA specification was introduced (2006) later to standardize ORMs in Java, and Hibernate eventually integrated JPA support (2010). The Spring Data project then introduced Spring Data JPA (2011) to simplify data access in Spring applications using JPA.<\/cite><\/blockquote>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2001 r. \u2013 Native Hibernate API.<\/li>\n\n\n\n<li>2006 r. \u2013 JPA specification.<\/li>\n\n\n\n<li>2010 r. \u2013 JPA-standard API w Hibernate.<\/li>\n\n\n\n<li>2011 r. \u2013 Spring Data JPA.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"native-hibernate-api-sessionfactory\">Native Hibernate API \u2013 SessionFactory<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">One of the available options is the Native Hibernate API. In short, to use the Native Hibernate API we need a SessionFactory \u2013 <a href=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/userguide\/html_single\/Hibernate_User_Guide.html#bootstrap-native\" data-type=\"link\" data-id=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/userguide\/html_single\/Hibernate_User_Guide.html#bootstrap-native\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate Native Bootstrapping<\/a>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote has-normal-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-normal-font-size wp-block-paragraph\">SessionFactory<\/p>\n<cite><strong>Javadoc:<\/strong> The main contract here is the creation of Session instances. Usually an application has a single SessionFactory instance and threads servicing client requests obtain Session instances from this factory.<br><br>The internal state of a SessionFactory is immutable. Once it is created this internal state is set. This internal state includes all of the metadata about Object\/Relational Mapping.<br><br>Implementors must be threadsafe.<\/cite><\/blockquote>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class HibernateNativeBasicConfigurationTest {\n    private SessionFactory sessionFactory;\n\n    @BeforeEach\n    void setUp() {\n        StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()\n                .configure()\n                .build();\n\n        try {\n            sessionFactory = new MetadataSources(serviceRegistry)\n                    .buildMetadata()\n                    .buildSessionFactory();\n        } catch (Exception e) {\n            e.printStackTrace();\n            StandardServiceRegistryBuilder.destroy(serviceRegistry);\n        }\n    }\n\n    @AfterEach\n    void tearDown() {\n        if (sessionFactory != null) {\n            sessionFactory.close();\n        }\n    }\n}<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-text-align-left has-large-font-size wp-block-paragraph\">Code on GitHub -&gt; <a href=\"https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/blob\/master\/src\/test\/java\/pl\/juniorjavadeveloper\/examples\/hibernate\/basic\/configuration\/HibernateNativeBasicConfigurationTest.java\" data-type=\"link\" data-id=\"https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/blob\/master\/src\/test\/java\/pl\/juniorjavadeveloper\/examples\/hibernate\/basic\/configuration\/HibernateNativeBasicConfigurationTest.java\" target=\"_blank\" rel=\"noreferrer noopener\">HibernateNativeBasicConfigurationTest<\/a><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">In addition to SessionFactory, we also need Hibernate configuration, e.g. in the form of an XML file - <strong>hibernate.cfg.xml<\/strong>. Below is a fragment of the configuration with a link to GitHub with the full content of the configuration file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version='1.0' encoding='utf-8'?&gt;\n&lt;!DOCTYPE hibernate-configuration PUBLIC\n        \"-\/\/Hibernate\/Hibernate Configuration DTD 3.0\/\/EN\"\n        \"http:\/\/www.hibernate.org\/dtd\/hibernate-configuration-3.0.dtd\"&gt;\n&lt;hibernate-configuration&gt;\n    &lt;session-factory&gt;\n        &lt;!-- https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/blob\/master\/src\/test\/resources\/hibernate.cfg.xml --&gt;\n    &lt;\/session-factory&gt;\n&lt;\/hibernate-configuration&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"jpa-standard-api-entitymanager\">JPA-standard API \u2013 EntityManager<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">Another option is the JPA-standard API, which is the implementation of the Java\/Jakarta Persistence API specification in Hibernate. In short, to use the JPA-standard API we need EntityManager \u2013 <a href=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/userguide\/html_single\/Hibernate_User_Guide.html#bootstrap-jpa\" data-type=\"link\" data-id=\"https:\/\/docs.jboss.org\/hibernate\/orm\/6.4\/userguide\/html_single\/Hibernate_User_Guide.html#bootstrap-native\" target=\"_blank\" rel=\"noreferrer noopener\">Hibernate Jakarta Persistence Bootstrapping<\/a>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote has-normal-font-size is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-normal-font-size wp-block-paragraph\">EntityManager<\/p>\n<cite><strong>Javadoc:<\/strong> Interface used to interact with the persistence context.<br><br>An EntityManager instance is associated with a persistence context. A persistence context is a set of entity instances in which for any persistent entity identity there is a unique entity instance. Within the persistence context, the entity instances and their lifecycle are managed. The EntityManager API is used to create and remove persistent entity instances, to find entities by their primary key, and to query over entities.<br><br>The set of entities that can be managed by a given EntityManager instance is defined by a persistence unit. A persistence unit defines the set of all classes that are related or grouped by the application, and which must be colocated in their mapping to a single database.<\/cite><\/blockquote>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class HibernateJpaBasicConfigurationTest {\n    private EntityManagerFactory entityManagerFactory;\n\n    @BeforeEach\n    void setUp() {\n        entityManagerFactory = Persistence.createEntityManagerFactory(\n                \"pl.juniorjavadeveloper.examples.hibernate.basic.configuration.pu\");\n    }\n\n    @AfterEach\n    void tearDown() {\n        if (entityManagerFactory != null) {\n            entityManagerFactory.close();\n        }\n    }\n}<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">Code on GitHub -&gt; <a href=\"https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/blob\/master\/src\/test\/java\/pl\/juniorjavadeveloper\/examples\/hibernate\/basic\/configuration\/HibernateJpaBasicConfigurationTest.java\" target=\"_blank\" rel=\"noreferrer noopener\">HibernateJpaBasicConfigurationTest<\/a><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Poza EntityManager potrzebujemy jeszcze konfiguracje Java\/Jakarta Persistence np.: w postaci pliku XML &ndash; <strong>persistence.xml<\/strong>. Below is a fragment of the configuration with a link to GitHub with the full content of the configuration file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;persistence xmlns=\"http:\/\/java.sun.com\/xml\/ns\/persistence\"\n             xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n             xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/persistence http:\/\/java.sun.com\/xml\/ns\/persistence\/persistence_2_0.xsd\"\n             version=\"2.0\"&gt;\n    &lt;persistence-unit name=\"pl.juniorjavadeveloper.examples.hibernate.basic.configuration.pu\"&gt;\n        &lt;!-- https:\/\/github.com\/juniorjavadeveloper-pl\/hibernate-examples\/blob\/master\/src\/test\/resources\/META-INF\/persistence.xml --&gt;\n    &lt;\/persistence-unit&gt;\n&lt;\/persistence&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"spring-data-jpa-jparepository-crudrepository\">Spring Data JPA &ndash; JpaRepository \/ CrudRepository<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Using the Spring Framework, we can add the Spring Data JPA module to simplify data access in Spring applications using JPA.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Repository<\/p>\n<cite><strong>Javadoc:<\/strong> Central repository marker interface. Captures the domain type to manage as well as the domain type&rsquo;s id type. General purpose is to hold type information as well as being able to discover interfaces that extend this one during classpath scanning for easy Spring bean creation.<br><br>Domain repositories extending this interface can selectively expose CRUD methods by simply declaring methods of the same signature as those declared in CrudRepository.<\/cite><\/blockquote>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Repository\npublic interface AnimalRepository extends JpaRepository&lt;Animal, Long&gt; {\n}<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-large-font-size wp-block-paragraph\">Oficjalny tutorial -&gt; <a href=\"https:\/\/spring.io\/guides\/gs\/accessing-data-jpa\/\" data-type=\"link\" data-id=\"https:\/\/spring.io\/guides\/gs\/accessing-data-jpa\/\">Accessing Data with JPA<\/a><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph translation-block\">Spring Boot provides us with default configuration in the form of a properties file \u2013 <strong>application.properties<\/strong>. Below is an example of a configuration.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">spring.datasource.url=jdbc:h2:~\/hibernate-examples\nspring.datasource.driverClassName=org.h2.Driver\nspring.datasource.username=sa\nspring.datasource.password=\nspring.jpa.database-platform=org.hibernate.dialect.H2Dialect\nspring.jpa.hibernate.ddl-auto=update<\/pre>\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"gdzie-uzywac-hibernate\">Where to use Hibernate<\/h2>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Below I will briefly describe where, from my experience, different ways of using Hibernate can be used.<\/p>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"native-aplikacje-stand-alone\">Native \u2013 stand-alone applications<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Je&#380;eli chcemy &ldquo;lekk&#261;&rdquo; aplikacj&#281;&nbsp; i nie potrzebujemy ca&#322;ego &ldquo;baga&#380;u&rdquo; zwi&#261;zanego z Java EE oraz Spring Framework, to w zupe&#322;no&#347;ci wystarczy nam Hibernate Native API. U&#380;ywa&#322;em tej opcji do tworzenia aplikacji desktopowych np.: w JavaFX lub dla oddzielnych, niezale&#380;nych modu&#322;&oacute;w aplikacji.<\/p>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"jpa-standard-aplikacje-java-ee\">JPA-standard &ndash; aplikacje Java EE<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">When creating Java EE applications, we can use JPA, but then we need to add a JPA implementation (JAR file), maybe Hibernate. We place applications for Java EE on application servers that may have a JPA implementation available, then we simply replace it with Hibernate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"spring-data-jpa-aplikacje-dla-spring-framework\">Spring Data JPA \u2013 applications for Spring Framework<\/h3>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">The answer to this question is obvious \u2013 applications for Spring Framework.<\/p>\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"czy-ktos-w-ogole-uzywa-hibernate\">Does anyone use Hibernate at all?<\/h2>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">Uwaga, na koniec granat! Z mojego komercyjnego do&#347;wiadczenia wynika, &#380;e Hibernate nie jest u&#380;ywany w systemach produkcyjnych. Jak, to mo&#380;liwe?! Niestety Hibernate jest wolny i niewydajny, ma za du&#380;y narzut generycznych, og&oacute;lnych koncepcji i rozwi&#261;za&#324;. Jest, to &ldquo;kombajn&rdquo; do wszystkiego i dla ka&#380;dej bazy danych. Hibernate bardzo dobrze si&#281; sprawdza do szybkiego prototypownia oraz tworzenia aplikacji typu proof-of-concept. No i oczywi&#347;cie do tworzenia aplikacji CRUD do naszego portfolio na potrzeby rekrutacji &#128521; Je&#380;eli nie Hibernate, to co? Oczywi&#347;cie dobre stare JDBC i\/lub Spring JdbcTemplate.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Lesson: JDBC Basics (The Java&trade; Tutorials &gt; JDBC Database Access)<\/p>\n<cite>In this lesson you will learn the basics of the JDBC API. &#377;r&oacute;d&#322;o: <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/jdbc\/basics\/index.html\" data-type=\"link\" data-id=\"https:\/\/docs.oracle.com\/javase\/tutorial\/jdbc\/basics\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.oracle.com\/javase\/tutorial\/jdbc\/basics\/index.html<\/a><\/cite><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Accessing Relational Data using JDBC with Spring<\/p>\n<cite>You will build an application that uses Spring&rsquo;s <code>JdbcTemplate<\/code> to access data stored in a relational database. &#377;r&oacute;d&#322;o: <a href=\"https:\/\/spring.io\/guides\/gs\/relational-data-access\/\" data-type=\"link\" data-id=\"https:\/\/spring.io\/guides\/gs\/relational-data-access\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/spring.io\/guides\/gs\/relational-data-access\/<\/a><\/cite><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading joli-heading jtoc-heading\" id=\"podsumowanie\">Summary<\/h2>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">I believe that the grenade thrown at the end will not discourage you from using Hibernate. Once we understand the capabilities of Hibernate, it will be easier to adapt a specific way of using Hibernate to our needs. I hope that people learning Hibernate will no longer drown in the sea of possibilities offered by Hibernate when looking for solutions on the Internet. Using Hibernate, you can create proof-of-concept applications easily and quickly.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-poradnik-dla-przysz-ych-junior-java-developer-039-w wp-block-embed-poradnik-dla-przysz-ych-junior-java-developer-039-w\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"oqlGIeuJom\"><a href=\"https:\/\/www.juniorjavadeveloper.pl\/en\/kontakt\/\">Contact<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&bdquo;Kontakt&rdquo; &mdash; Poradnik dla przysz&#322;ych Junior Java Developer&amp;apos;&oacute;w\" src=\"https:\/\/www.juniorjavadeveloper.pl\/kontakt\/embed\/#?secret=C643IyttDK#?secret=oqlGIeuJom\" data-secret=\"oqlGIeuJom\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-poradnik-dla-przysz-ych-junior-java-developer-039-w wp-block-embed-poradnik-dla-przysz-ych-junior-java-developer-039-w\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"vNHIkPyXNE\"><a href=\"https:\/\/www.juniorjavadeveloper.pl\/en\/mentoring-rezerwuj-termin\/\">Mentoring - book an appointment<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&bdquo;Mentoring &ndash; rezerwuj termin&rdquo; &mdash; Poradnik dla przysz&#322;ych Junior Java Developer&amp;apos;&oacute;w\" src=\"https:\/\/www.juniorjavadeveloper.pl\/mentoring-rezerwuj-termin\/embed\/#?secret=0IdkG4h2F5#?secret=vNHIkPyXNE\" data-secret=\"vNHIkPyXNE\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>","protected":false},"excerpt":{"rendered":"<p>W tym artykule postaram si\u0119 pom\u00f3c odnale\u017a\u0107 si\u0119 w g\u0105szczu mo\u017cliwo\u015bci jakie daje Hibernate. Wyja\u015bni\u0119, gdzie i jak wykorzysta\u0107 tytu\u0142owe SessionFactory, EntityManager oraz JpaRepository\/CrudRepository. Osoby ucz\u0105ce si\u0119 Hibernate nieraz szukaj\u0105c rozwi\u0105za\u0144 w internecie natrafiaj\u0105 na morze mo\u017cliwo\u015bci. Wst\u0119p Zaczynaj\u0105c swoj\u0105 przygod\u0119 z Hibernate wiele os\u00f3b gubi si\u0119 w morzu mo\u017cliwo\u015bci, kt\u00f3re oferuje Hibernate. Zaczn\u0119 od [&hellip;]<\/p>","protected":false},"author":1,"featured_media":4001,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_ppp_document_settings_meta":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[7],"tags":[],"class_list":["post-3787","post","type-post","status-publish","format-standard","has-post-thumbnail","category-poradnik"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.juniorjavadeveloper.pl\/wp-content\/uploads\/2024\/01\/OMG-ORM-JPA-Hibernate.png","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/posts\/3787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/comments?post=3787"}],"version-history":[{"count":44,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/posts\/3787\/revisions"}],"predecessor-version":[{"id":3997,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/posts\/3787\/revisions\/3997"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/media\/4001"}],"wp:attachment":[{"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/media?parent=3787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/categories?post=3787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.juniorjavadeveloper.pl\/en\/wp-json\/wp\/v2\/tags?post=3787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}