{"id":18344,"date":"2015-01-14T10:44:08","date_gmt":"2015-01-14T08:44:08","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=18344"},"modified":"2019-02-27T14:01:19","modified_gmt":"2019-02-27T12:01:19","slug":"jpa-entitymanager-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/","title":{"rendered":"JPA EntityManager Example"},"content":{"rendered":"<p>In this example, we shall try to demonstrate how to use <code>JPA EntityManager<\/code>. As the name suggests, an <code>EntityManager<\/code> is a class that manages the state of the <code>Entity<\/code>(Persist\/Update\/Delete etc).<\/p>\n<p>Every <code>EntityManager<\/code> object has an instance of <code>EntityTransaction<\/code> associated with it. <code>EntityTransaction<\/code> is used to manage the transactions.<\/p>\n<p>We shall be using <a title=\"Hibernate\" href=\"http:\/\/hibernate.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Hibernate<\/a> as the JPA Vendor. The underlying database shall be MySQL.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nThe benefit of using the <code>JPA<\/code> over any specific ORM related libraries like Hibernate, iBatis is that we need not change the code when we change the vendor. The code is decoupled (or loosely coupled) with the underlying ORM framework.<\/p>\n<p>Let&#8217;s build a sample application to see how we can avoid using <code>Hibernate<\/code> specific interfaces and use <code>JPA interfaces<\/code> instead:<\/p>\n<p><span style=\"text-decoration: underline\"> <em>Employee.java:<\/em><br \/>\n<\/span><\/p>\n<pre class=\"brush:java\">package com.jcg.pojo;\n\nimport javax.persistence.Column;\nimport javax.persistence.Entity;\nimport javax.persistence.GeneratedValue;\nimport javax.persistence.GenerationType;\nimport javax.persistence.Id;\nimport javax.persistence.Table;\n\n@Entity\n@Table(name=\"employee\")\npublic class Employee\n{\n\t\tprotected Long employeeId;\n\t\t\n\t\tprotected String name;\n\n\t\t@Id\n\t\t@Column(name=\"employee_id\")\n\t\t@GeneratedValue(strategy=GenerationType.IDENTITY)\n\t\tpublic  Long getEmployeeId()\n\t\t{\n\t\t\t\treturn employeeId;\n\t\t}\n\n\t\tpublic  void setEmployeeId(Long employeeId)\n\t\t{\n\t\t\t\tthis.employeeId = employeeId;\n\t\t}\n\n\t\t@Column(name=\"employee_name\")\n\t\tpublic  String getName()\n\t\t{\n\t\t\t\treturn name;\n\t\t}\n\n\t\tpublic  void setName(String name)\n\t\t{\n\t\t\t\tthis.name = name;\n\t\t}\n\n\t\t@Override\n    public String toString()\n    {\n\t\t    return \"Employee [employeeId=\" + employeeId + \", name=\" + name + \"]\";\n    }\n\t\t\n\t\t\n}\n\n<\/pre>\n<p><span style=\"text-decoration: underline\"> <em>JPADemo.java:<\/em><br \/>\n<\/span><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">package com.jcg;\n\nimport javax.persistence.EntityManager;\nimport javax.persistence.EntityManagerFactory;\nimport javax.persistence.Persistence;\n\nimport com.isg.maps.Employee;\n\n\n\/**\n * @author Chandan Singh\n *\n *\/\npublic class JPADemo\n{\n\t\tpublic static void main(String[] args)\n    {\n\t\t\t\tEntityManagerFactory emf = Persistence.createEntityManagerFactory(\"jcg-JPA\");\n\t\t\t\tEntityManager em = emf.createEntityManager();\n\t\t\t\t\n\t\t\t\tem.getTransaction().begin();\n\t\t\t\tEmployee employee = new Employee();\n\t\t\t\temployee.setName(\"Chandan\");\n\t\t\t\tSystem.out.println(\"COMIITING\");\n\t\t\t\tem.persist(employee);\n\t\t\t\tem.getTransaction().commit();\n\t\t\t\t\n    }\n}\n\n<\/pre>\n<p><span style=\"text-decoration: underline\"> <em>persistence.java:<\/em><br \/>\n<\/span><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&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        \n        &lt;persistence-unit name=\"jcg-JPA\"&gt;\n        \t&lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;\/provider&gt;\n\t\t&lt;properties&gt;\n\t\t\t&lt;property name=\"hibernate.dialect\" value=\"org.hibernate.dialect.MySQL5InnoDBDialect\" \/&gt;\n\t\t\t&lt;property name=\"hibernate.hbm2ddl.auto\" value=\"update\" \/&gt;\n\t\t\t&lt;property name=\"hibernate.connection.driver_class\" value=\"com.mysql.jdbc.Driver\" \/&gt;\n\t\t\t&lt;property name=\"hibernate.connection.username\" value=\"myusername\" \/&gt;\n\t\t\t&lt;property name=\"hibernate.connection.password\" value=\"mypwd\" \/&gt;\n\t\t\t&lt;property name=\"hibernate.connection.url\" value=\"jdbc:mysql:\/\/localhost\/research_development\" \/&gt;\n\t\t&lt;\/properties&gt;\n        &lt;\/persistence-unit&gt;\n&lt;\/persistence&gt;\n<\/pre>\n<ol>\n<li>We define the connection properties in the <code>persistence.xml<\/code>.<\/li>\n<li>Then we look up the persistence unit from the <code>createEntityManagerFactory<\/code> method of <code>Persistence<\/code> class of JPA. This returns an object of <code>EntityManagerFactory<\/code>.<\/li>\n<li>Finally, we can get the <code>EntityManager<\/code> object from the <code>EntityManagerFactory<\/code> class.<\/li>\n<li>We ,now, use the <code>EntityManager<\/code> object to perform <code>CRUD<\/code> operation on the <code>Entities<\/code> under the scope of an <code>EntityTransaction<\/code> object.<\/li>\n<li>The last step is to <code>commit<\/code> the <code>transaction<\/code> back tot the database.<\/li>\n<\/ol>\n<div class=\"tip\"><strong>TIP:<\/strong><br \/>\nIt is mandatory to place <code>persistence.xml<\/code> in the <code>META-INF<\/code> folder.<\/div>\n<h2>Conclusion:<\/h2>\n<p>Thus we studied about the <code>JPA EntityManager<\/code> and how we can use it to avoid dependency on any particular ORM Framework.[ulp id=&#8217;WII99u1JyPvMb8sP&#8217;]<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the source code of this example here: <a href=\"http:\/\/a5e2fba00d8bcb729d89839f.javacodegeeks.netdna-cdn.com\/wp-content\/uploads\/2015\/01\/JavaEEProject.zip\"><strong>JPAEntityManager.zip<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example, we shall try to demonstrate how to use JPA EntityManager. As the name suggests, an EntityManager is a class that manages the state of the Entity(Persist\/Update\/Delete etc). Every EntityManager object has an instance of EntityTransaction associated with it. EntityTransaction is used to manage the transactions. We shall be using Hibernate as the &hellip;<\/p>\n","protected":false},"author":30,"featured_media":1240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-18344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jpa"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JPA EntityManager Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Example to demonstrate the use of EntityManager in JPA\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JPA EntityManager Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Example to demonstrate the use of EntityManager in JPA\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-14T08:44:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-27T12:01:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Chandan Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chandan Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\"},\"author\":{\"name\":\"Chandan Singh\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/86537f90d4f34206febe90a0fbd6cd33\"},\"headline\":\"JPA EntityManager Example\",\"datePublished\":\"2015-01-14T08:44:08+00:00\",\"dateModified\":\"2019-02-27T12:01:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\"},\"wordCount\":238,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"articleSection\":[\"jpa\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\",\"name\":\"JPA EntityManager Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"datePublished\":\"2015-01-14T08:44:08+00:00\",\"dateModified\":\"2019-02-27T12:01:19+00:00\",\"description\":\"Example to demonstrate the use of EntityManager in JPA\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jpa\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jpa\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JPA EntityManager Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/86537f90d4f34206febe90a0fbd6cd33\",\"name\":\"Chandan Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/10\/Chandan-Singh-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/10\/Chandan-Singh-96x96.jpg\",\"caption\":\"Chandan Singh\"},\"description\":\"Chandan holds a degree in Computer Engineering and is a passionate software programmer. He has good experience in Java\/J2EE Web-Application development for Banking and E-Commerce Domains.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/chandan-singh\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JPA EntityManager Example - Java Code Geeks","description":"Example to demonstrate the use of EntityManager in JPA","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/","og_locale":"en_US","og_type":"article","og_title":"JPA EntityManager Example - Java Code Geeks","og_description":"Example to demonstrate the use of EntityManager in JPA","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-01-14T08:44:08+00:00","article_modified_time":"2019-02-27T12:01:19+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Chandan Singh","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Chandan Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/"},"author":{"name":"Chandan Singh","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/86537f90d4f34206febe90a0fbd6cd33"},"headline":"JPA EntityManager Example","datePublished":"2015-01-14T08:44:08+00:00","dateModified":"2019-02-27T12:01:19+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/"},"wordCount":238,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","articleSection":["jpa"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/","name":"JPA EntityManager Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","datePublished":"2015-01-14T08:44:08+00:00","dateModified":"2019-02-27T12:01:19+00:00","description":"Example to demonstrate the use of EntityManager in JPA","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-entitymanager-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"jpa","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jpa\/"},{"@type":"ListItem","position":5,"name":"JPA EntityManager Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/86537f90d4f34206febe90a0fbd6cd33","name":"Chandan Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/10\/Chandan-Singh-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/10\/Chandan-Singh-96x96.jpg","caption":"Chandan Singh"},"description":"Chandan holds a degree in Computer Engineering and is a passionate software programmer. He has good experience in Java\/J2EE Web-Application development for Banking and E-Commerce Domains.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/chandan-singh\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/18344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=18344"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/18344\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1240"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=18344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=18344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=18344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}