{"id":3887,"date":"2020-07-01T18:06:52","date_gmt":"2020-07-01T12:36:52","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=3887"},"modified":"2020-07-01T18:06:54","modified_gmt":"2020-07-01T12:36:54","slug":"hibernate-associations","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/hibernate-associations\/","title":{"rendered":"Hibernate Associations"},"content":{"rendered":"\n<p>Hibernate Associations technology handles how to persist java objects. But, it is possible only when the object has the XML-file that describes how to map it, or the object is annotated with hibernate annotations. In another case, the objects will be just simple plain java objects without relation to the database tables. Very often several entities can be related. In this situation, they must have references from each other. Such objects can have unidirectional or bidirectional references. We are going to understand in details how to deal with such situations.<\/p>\n\n\n\n<p>Java objects can contain references to one or several other Java objects. They can have direct references as an embedded property or field. In the case of indirect references,&nbsp; it is usually implemented via arrays, sets, lists, etc. These associations are represented in the database with foreign key relationships.&nbsp;<\/p>\n\n\n\n<p>If only one of the pair of <a href=\"https:\/\/www.h2kinfosys.com\/blog\/nested-classes-in-java\/\">Java classes<\/a> contains a reference to the other, the association is called unidirectional. In the cases of the mutual association, we get the bidirectional relation.<\/p>\n\n\n\n<p>The widespread beginner&#8217;s mistake in designing entity models is to try to make all associations bidirectional.&nbsp; It is important to remember that associations that do not look like a natural part of the model of your object should not be forced into it.<\/p>\n\n\n\n<p><img fetchpriority=\"high\" decoding=\"async\" width=\"614\" height=\"202\" src=\"https:\/\/lh4.googleusercontent.com\/4a_JORpEO4KYsH1GCtXahxl37A4H_hyk8aWmfLP5MKLZMwVDgQq-R4sroSuL-vQTRVyVP8uz8nyxkYQgr5p0gvwEq5lpVlz5GpI6t7LziM6PgbMoRx1gasah2qTTVlg1Ewxs8rtC\" alt=\"\" title=\"\"><\/p>\n\n\n\n<p>Before starting with code we need to create User and Address tables and relationships in our <a href=\"https:\/\/en.wikipedia.org\/wiki\/MySQL\" rel=\"nofollow noopener\" target=\"_blank\">MySql database<\/a> exampledb by running queries:<\/p>\n\n\n<p>[box type=&#8221;shadow&#8221; align=&#8221;&#8221; class=&#8221;&#8221; width=&#8221;&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">create table exampledb.USER (<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; user_id INT NOT NULL auto_increment,<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; first_name VARCHAR(100) default NULL,<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; last_name&nbsp; VARCHAR(100) default NULL,<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; PRIMARY KEY (user_id)<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">);<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">create table exampledb.address (<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; address_id INT NOT NULL auto_increment,<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; city VARCHAR(20) default NULL,<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; address&nbsp; VARCHAR(20) default NULL,<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; PRIMARY KEY (address_id),<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\"> &nbsp; CONSTRAINT user_address FOREIGN KEY (address_id) REFERENCES user(user_id) ON DELETE CASCADE <\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">);<\/span><\/p>\n<p>[\/box]<\/p>\n\n\n<p><strong><em>Here are our entities in code:<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n<strong>import<\/strong> javax.persistence.*;\n\n@Entity\n@Table(name = \"User\")\n<strong>public<\/strong> <strong>class<\/strong> UserEntity <strong>implements<\/strong> Serializable {\n@Id\n@Column(name = \"user_id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n@Column(name = \"first_name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String firstName;\n@Column(name = \"last_name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String lastName;\n\n@OneToOne(mappedBy=\"user\", cascade = CascadeType.<strong><em>ALL<\/em><\/strong>)\nAddressEntity address;\n\n<strong>public<\/strong> String getFirstName() {\n<strong>return<\/strong> firstName;\n}\n\n<strong>public<\/strong> <strong>void<\/strong> setFirstName(String firstName) {\n<strong>this<\/strong>.firstName = firstName;\n}\n\n<strong>public<\/strong> String getLastName() {\n<strong>return<\/strong> lastName;\n}\n\n<strong>public<\/strong> <strong>void<\/strong> setLastName(String lastName) {\n<strong>this<\/strong>.lastName = lastName;\n}\n\n<strong>public<\/strong> AddressEntity getAddress() {\n<strong>return<\/strong> address;\n}\n\n<strong>public<\/strong> <strong>void<\/strong> setAddress(AddressEntity address) {\n<strong>this<\/strong>.address = address;\n}\n\n<strong>public<\/strong> Integer getId() {\n<strong>return<\/strong> id;\n}\n}\n<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n\n<strong>import<\/strong> javax.persistence.*;\n\n@Entity\n@Table(name = \"Address\")\n<strong>public<\/strong> <strong>class<\/strong> AddressEntity&nbsp; <strong>implements<\/strong> Serializable{\n@Id\n@Column(name = \"address_id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n&nbsp;\n@Column(name = \"city\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 20)\n<strong>private<\/strong> String city;\n&nbsp;&nbsp;&nbsp;\n@Column(name = \"address\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 20)\n<strong>private<\/strong> String address;\n&nbsp;\n@OneToOne\n@PrimaryKeyJoinColumn\nUserEntity user;\n\n\/\/getters and setters\n}\nAnd, the second entity:\n<strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n\n<strong>import<\/strong> javax.persistence.*;\n\n@Entity\n@Table(name = \"Address\")\n<strong>public<\/strong> <strong>class<\/strong> AddressEntity <strong>implements<\/strong> Serializable {\n@Id\n@Column(name = \"address_id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n\n@Column(name = \"city\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 20)\n<strong>private<\/strong> String city;\n\n@Column(name = \"address\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 20)\n<strong>private<\/strong> String address;\n\n@OneToOne\n@PrimaryKeyJoinColumn\nUserEntity user;\n\n\/\/getters and setters\n}\n<\/pre>\n\n\n\n<p>In our case, with cascade operations and one-to-one relationships, it is enough to same just one entity into the database. Let&#8217;s create User and Address objects, save one of them into the database. After, we will create a new session and get our entities from the database to make sure that both User and Address objects were persisted.<\/p>\n\n\n\n<p><strong><em>package edu.hibernate.example;<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import java.util.Iterator;\nimport java.util.List;\n\nimport org.hibernate.Session;\nimport org.hibernate.cfg.Configuration;\n\npublic class HibernateExample {\n\npublic static void main(String[] args) {\nConfiguration configuration = new Configuration();\nconfiguration.addAnnotatedClass(edu.hibernate.example.UserEntity.class);\nconfiguration.addAnnotatedClass(edu.hibernate.example.AddressEntity.class);\nSession session1 = configuration.configure().buildSessionFactory().openSession();\n&nbsp;\nsession1.beginTransaction();\n\n\/\/ Create new User object\nUserEntity user = new UserEntity();\nuser.setFirstName(\"Jozeph\");\nuser.setLastName(\"Jonson\");\n\n\/\/ Create new Address object\nAddressEntity address = new AddressEntity();\naddress.setCity(\"Berlin\");\naddress.setAddress(\"High str., 111\");\n\nuser.setAddress(address);\naddress.setUser(user);\nsession1.save(user);\n\/\/ session1.save(address);\n\nsession1.getTransaction().commit();\nInteger userId = user.getId();\nInteger addressId = address.getId();\n\nSession session2 = configuration.configure().buildSessionFactory().openSession();\nsession2.beginTransaction();\nUserEntity userDB = (UserEntity) session2.get(UserEntity.class, userId);\nAddressEntity addressDB = (AddressEntity) session2.get(AddressEntity.class, addressId);\n\nSystem.out.println(userDB.getId());\nSystem.out.println(userDB.getAddress().getId());\nSystem.out.println(addressDB.getId());\nSystem.out.println(addressDB.getUser().getId());\n\n}\n}\n<\/pre>\n\n\n\n<p>There are two more ways to create one-to-one relationships that are less popular. For example, we can create one more table to store keys of User and Address tables, one record is responsible for one relationship between User and Address objects. The table is called a common join table.<\/p>\n\n\n\n<p>One more way is to create a one-to-one mapping with a shared primary key<\/p>\n\n\n\n<p>In this technique, we have to use a common primary key value in both the tables.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>One-to-many association<\/strong><\/h2>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/PFQSeOx3bJCBUSP-oFsYbDVki1xXNAJlfGIluoUC4_6H9IK0Tpb20WiyT6HBArn359kJQOE2jgWiNMbJwO9q0gFhS7N2DF5emHMMpnRgxGRJ7rghNZbClISeFt6XQuyQXilZfj8g\" width=\"631\" height=\"199\" alt=\"\" title=\"\"><\/p>\n\n\n\n<p>In a one-to-many approach, both entities are responsible for creating the relationship and maintaining it. The UserEntity needs to declare one-to-many relationships, the CarEntity declares is many-to-one from its end. Let&#8217;s look at the code of User and Car entities.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n<strong>import<\/strong> java.util.Set;\n\n<strong>import<\/strong> javax.persistence.*;\n\n@Entity\n@Table(name = \"User\")\n<strong>public<\/strong> <strong>class<\/strong> UserEntity <strong>implements<\/strong> Serializable {\n@Id\n@Column(name = \"user_id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n@Column(name = \"first_name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String firstName;\n@Column(name = \"last_name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String lastName;\n\n@OneToMany(cascade = CascadeType.<strong><em>ALL<\/em><\/strong>)\n@JoinColumn(name = \"USERE_ID\")\n<strong>private<\/strong> Set&lt;CarEntity&gt; cars;\n\n\/\/ Getters and setters\n}\n<strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n\n<strong>import<\/strong> javax.persistence.Column;\n<strong>import<\/strong> javax.persistence.Entity;\n<strong>import<\/strong> javax.persistence.GeneratedValue;\n<strong>import<\/strong> javax.persistence.GenerationType;\n<strong>import<\/strong> javax.persistence.Id;\n<strong>import<\/strong> javax.persistence.ManyToOne;\n<strong>import<\/strong> javax.persistence.Table;\n\n@Entity\n@Table(name = \"Car\")\n<strong>public<\/strong> <strong>class<\/strong> CarEntity <strong>implements<\/strong> Serializable {\n@Id\n@Column(name = \"car_id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n\n@Column(name = \"model\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 20)\n<strong>private<\/strong> String model;\n\n@ManyToOne\n<strong>private<\/strong> UserEntity user;\n\n\/\/ Getters and setters\n}\n<\/pre>\n\n\n\n<p>Besides one-to-many mapping with a foreign key association, Hibernate also allows doing one-to-many mapping with a join table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Many-to-many association<\/strong><\/h2>\n\n\n\n<p>Hibernate many-to-many mapping is between two entities where one can have a relation with multiple another entity and vise versa. For example,&nbsp; a user can be subscribed to several sites with the news. Every site with the news has a lot of users. Here is the schema:<br><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/-B8EFUkQFh7ShgysbSrGJIhEuyg6pVYIsRAXXhGIab_VXBruF1KK-YBO33batAxSAwbegOMBT6xvYfuhn8M4-PVTraP5Tg9UiA2K34zIe8znX6lbjjLAs-0AC6xp7sy40vipbsHw\" width=\"630\" height=\"156\" alt=\"\" title=\"\"><\/p>\n\n\n\n<p>Let&#8217;s look at the code of out entities:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n<strong>import<\/strong> java.util.Set;\n\n<strong>import<\/strong> javax.persistence.*;\n\n@Entity\n@Table(name = \"User\")\n<strong>public<\/strong> <strong>class<\/strong> UserEntity <strong>implements<\/strong> Serializable {\n@Id\n@Column(name = \"id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n@Column(name = \"first_name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String firstName;\n@Column(name = \"last_name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String lastName;\n\n&nbsp;&nbsp;&nbsp;&nbsp;@ManyToMany(cascade=CascadeType.<strong><em>ALL<\/em><\/strong>)\n&nbsp;&nbsp;&nbsp;&nbsp;@JoinTable(name=\"USER_SUBSCRIPTIONS\", joinColumns={@JoinColumn(referencedColumnName=\"ID\")}, inverseJoinColumns={@JoinColumn(referencedColumnName=\"ID\")})&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<strong>private<\/strong> Set&lt;SubscriptionEntity&gt; subscriptions;\n\/\/Getters and setters&nbsp;\n}\n\n<strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.io.Serializable;\n<strong>import<\/strong> java.util.Set;\n\n<strong>import<\/strong> javax.persistence.*;\n\n@Entity\n@Table(name = \"Subscription\")\n<strong>public<\/strong> <strong>class<\/strong> SubscriptionEntity <strong>implements<\/strong> Serializable {\n@Id\n@Column(name = \"id\", unique = <strong>true<\/strong>, nullable = <strong>false<\/strong>)\n@GeneratedValue(strategy = GenerationType.<strong><em>IDENTITY<\/em><\/strong>)\n<strong>private<\/strong> Integer id;\n@Column(name = \"name\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 20)\n<strong>private<\/strong> String name;\n@Column(name = \"link\", unique = <strong>false<\/strong>, nullable = <strong>false<\/strong>, length = 100)\n<strong>private<\/strong> String link;\n\n@ManyToMany(mappedBy=\"subscriptions\")\n<strong>private<\/strong> Set&lt;UserEntity&gt; subscriptions;\n&nbsp;\n\/\/Getters and setters&nbsp;\n\n}\n<\/pre>\n\n\n\n<p>UserEntity class is the owner entity, that is responsible for making the association and maintaining it. For this entity, we have used @JoinTable annotation. SubcriptionEntity is our mapped entity, which is mapped to UserEntity using the \u201cmappedBy\u201d attribute. Also, we user annotation @ManyToMany in both entities. Here is the way to work on such kinds of relationships.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>package<\/strong> edu.hibernate.example;\n\n<strong>import<\/strong> java.util.HashSet;\n<strong>import<\/strong> java.util.Set;\n\n<strong>import<\/strong> org.hibernate.Session;\n<strong>import<\/strong> org.hibernate.cfg.Configuration;\n\n<strong>public<\/strong> <strong>class<\/strong> HibernateExample {\n\n<strong>public<\/strong> <strong>static<\/strong> <strong>void<\/strong> main(String[] args)&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;{\nConfiguration configuration = <strong>new<\/strong> Configuration();\nconfiguration.addAnnotatedClass(edu.hibernate.example.UserEntity.<strong>class<\/strong>);\nconfiguration.addAnnotatedClass(edu.hibernate.example.SubscriptionEntity.<strong>class<\/strong>);\nSession session = configuration.configure().buildSessionFactory().openSession();\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SubscriptionEntity site1 = <strong>new<\/strong> SubscriptionEntity();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SubscriptionEntity site2 = <strong>new<\/strong> SubscriptionEntity();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set&lt;SubscriptionEntity&gt; subscriptions = <strong>new<\/strong> HashSet&lt;SubscriptionEntity&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subscriptions.add(site1);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subscriptions.add(site2);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UserEntity user1 = <strong>new<\/strong> UserEntity();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UserEntity user2 = <strong>new<\/strong> UserEntity();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set&lt;UserEntity&gt; users = <strong>new<\/strong> HashSet&lt;UserEntity&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;users.add(user1);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;users.add(user2);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user1.setSubscriptions(subscriptions);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user2.setSubscriptions(subscriptions);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session.save(user1);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session.save(user2);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session.getTransaction().commit();\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\n<\/pre>\n\n\n\n<p>We have created two instances of users and two instances of subscriptions. It is enough to save just user entities, all data about subscriptions and relationships will be persisted too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hibernate Associations technology handles how to persist java objects. But, it is possible only when the object has the XML-file that describes how to map it, or the object is annotated with hibernate annotations. In another case, the objects will be just simple plain java objects without relation to the database tables. Very often several [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3915,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[1046,1049,1048,1047],"class_list":["post-3887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-tutorials","tag-hibernate-associations","tag-many-to-many-association","tag-one-to-many-association","tag-one-to-one-relationships"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/3887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=3887"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/3887\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/3915"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=3887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=3887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=3887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}