{"id":736,"date":"2012-11-11T19:48:31","date_gmt":"2012-11-11T19:48:31","guid":{"rendered":"http:\/\/ilias-laptop\/examples\/enterprise-java\/jpa\/jpa-crud-example\/"},"modified":"2019-02-27T14:53:26","modified_gmt":"2019-02-27T12:53:26","slug":"jpa-crud-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/","title":{"rendered":"JPA CRUD Example"},"content":{"rendered":"<p>This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping facility for managing relational data in Java applications.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nHere, we are using JPA to perform create, delete, update and delete methods, as shown below:<\/p>\n<h3>Employee Class<\/h3>\n<p>The <code>Employee<\/code> class is an entity class, annotated with the <code>javax.persistence.Entity<\/code> annotation. It uses the <code>@Id<\/code> annotation to define its id property.<\/p>\n<pre class=\"brush:java\">package employeeDB;import javax.persistence.*;\n \n@Entity\npublicclass Employee {\n \n    @Id String name;\n    Double salary;\n \n    public Employee()\n    {\n \n    }\n \n    public Employee (String name, Double Salary)\n    {\n\n  this.name=name;\n\n  this.salary=Salary;\n    }\n \n    publicvoid setSalary(Double Salary)\n    {\n\n  this.salary=Salary;\n    }\n \n    publicString toString()\n    {\n\n  return\"Name: \"+name+\"nSalary: \"+salary ;\n    }\n \n}\n<\/pre>\n<h3>ExampleProgram<\/h3>\n<p>In the <code>ExampleProgram<\/code> we create four methods, <code>displayAll()<\/code>, <code>insert()<\/code>, <code>delete(String name)<\/code> and <code>modify(String name, Double Salary)<\/code> to perform the CRUD functionality. In all methods we use an EntityManager, using the <code>createEntityManager()<\/code> API method. The <code>getTransaction().begin()<\/code> and <code>getTransaction().commit()<\/code> methods are used before and after the <code>EntityManager<\/code> invokes a method so that a transaction begins and ends.<\/p>\n<ul>\n<li>In <code>displayAll()<\/code> method we use the <code>createQuery(java.lang.String qlString, java.lang.Class&lt;T&gt; resultClass)<\/code> method to create an instance of TypedQuery for executing a Java Persistence query language statement. Then using the <code>getResultList()<\/code> method of Query we get the list of the results.<\/li>\n<li>In <code>insert()<\/code> method a new object is writen to the database, using the <code>persist(java.lang.Object entity)<\/code> API method of <code>EntityManager<\/code>.<\/li>\n<li>In <code>delete(String name)<\/code> method an <code>Employee<\/code> object can be retrieved using the <code>find(java.lang.Class&lt;T&gt; entityClass, java.lang.Object primaryKey)<\/code> API method of EntityManager. Then it can be removed using the <code>remove(java.lang.Object entity)<\/code> API method of EntityManager.<\/li>\n<li>In <code>modify(String name, Double Salary)<\/code> method an <code>Employee<\/code> object can be retrieved using the <code>find(java.lang.Class&lt;T&gt; entityClass, java.lang.Object primaryKey)<\/code> API method of EntityManager. Then a field of the object can be modified using its setter.<\/li>\n<\/ul>\n<pre class=\"brush:java\">package employeeDB;\n \nimport javax.persistence.*;\nimport java.util.*;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n \npublic class Main {\n \n    \/**\n     * Displays all Employees in the Database\n     *\/\n    private static void displayAll()\n    {\n\n  em.getTransaction().begin();\n\n  TypedQuery  e=em.createQuery(displayAllQuery, Employee.class);\n\n  List &lt;Employee&gt; employees=e.getResultList();\n\n  if(employees.size()&gt;0)\n\n  {\nfor(Employee temp:employees)\n{\n    System.out.println(temp);\n    System.out.println();\n}\nSystem.out.println(employees.size()+\" Employee Records Available...!\");\n  }\n  else\nSystem.out.println(\"Database is Empty!\");\n  em.getTransaction().commit();\n    }\n \n    \/**\n     * Insets an Employee into the Database.\n     *\/\n    private static void insert()\n    {\nSystem.out.print(\"Enter the number of Employees to be inserted: \");\nn=input.nextInt();\nem.getTransaction().begin();\nfor(int i=0;i&lt;n;i++)\n{ \n    System.out.println(\"Enter the details of Employee \"+(i+1)+\": \");\n    System.out.print(\"Name: \");\n    \/\/I use BufferedReader to read String and hence I need to \n    \/\/ Catch the IOException that it may throw\n    try\n    {\n  name=bufferedReader.readLine();\n    }\n    catch (IOException e)\n    {\n  e.printStackTrace();\n    }\n    System.out.print(\"Salary: \");\n    Salary=input.nextDouble();\n    Employee emp=new Employee(name,Salary);\n    em.persist(emp);\n  \/\/Store emp into Database\n}\n  em.getTransaction().commit();\n  System.out.println(\"n\"+n+\" employee record(s) Created!n\");\n  TypedQuery  count=em.createQuery(countQuery,Employee.class);\n  System.out.println(\"n\"+count.getSingleResult()+\" employee record(s) Available in Database!n\");\n    }\n    \/**\n     * Deletes the specified Employee from the database\n     *@param name\n     *\/\n    private static void delete(String name)\n    {\n  em.getTransaction().begin();\n  Employee e=(Employee) em.find(Employee.class, name);\n   \/\/Find Object to be deleted\n  em.remove(e);\n\n\/\/Delete the Employee from database\n  System.out.printf(\"Employee %s removed from Database....\",e.name);\n  em.getTransaction().commit();\n  \/\/Display Number of Employees left\n  TypedQuery  count=em.createQuery(countQuery,Employee.class);\n  System.out.println(\"n\"+count.getSingleResult()+\" employee record(s) Available in Database!n\");\n   }\n    \/**\n     * Changes salary of the specified employee to passed salary\n     *@param name\n     *@param Salary\n     *\/\n    private static void modify(String name,Double Salary)\n    {\n  em.getTransaction().begin();\n  Employee e=(Employee) em.find(Employee.class, name);  \/\/Find Employee to be modified\n  e.setSalary(Salary);\n    \/\/Modify the salary\n  em.getTransaction().commit();\n  System.out.println(\"Modification Successful!n\");\n    }\n   public static void main(String arg[])\n    {\n  System.out.println(\"Welcome to the Employee Database System!nn\");\n  do{    \nSystem.out.print(\"Menu: n 1. View DBn2. Insert n3. Delete n4. Modifyn5. ExitnEnter Choice...\");\nint ch=input.nextInt();\ntry{\n    switch(ch)\n    {\n    case 1:\n  displayAll();\n  break;\n    case 2:\n  insert();\n  break;\n    case 3:\n  System.out.print(\"Name of Employee to be Deleted2: \");\n  name=bufferedReader.readLine();\n  delete(name);\n  break;\n    case 4:\n  System.out.print(\"Name of Employee to be Modified: \");\n  name=bufferedReader.readLine();\n  System.out.print(\"New Salary: \");\n  Salary=input.nextDouble();\n  modify(name,Salary);\n  break;\n    case 5:\n  if(em!=null) em.close();\n  \/\/Close EntityManager\n  if(emf!=null) emf.close();\n  \/\/Close EntityManagerFactory\n  exit=true;\n  break;\n    }\n}\ncatch (IOException e)\n{\n   e.printStackTrace();\n}\n  }while(!exit);\n    }\n    static EntityManagerFactory emf=Persistence.createEntityManagerFactory(\"empDB.odb\");\n    static EntityManager em=emf.createEntityManager();\n    static Scanner input=new Scanner(System.in);\n    static BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));\n \n    static int n;\n    static String name;\n    static Double Salary;\n    static boolean exit=false;\n \n    \/\/Query Repository\n    static String countQuery=\"Select count(emp) from Employee emp\";\n    static String displayAllQuery=\"Select emp from Employee emp\";\n }\n<\/pre>\n<p>This was an example of how to perform CRUD functionality in JPA.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div>[ulp id=&#8217;WII99u1JyPvMb8sP&#8217;]<\/p>\n<p><b>Related Article:<\/b><\/p>\n<ul style=\"text-align: left;\">\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/08\/java-persistence-api-quick-intro.html\">Java Persistence API: a quick intro&#8230;<\/a><\/li>\n<\/ul>\n<p><b><i>Reference: <\/i><\/b><a href=\"http:\/\/footyntech.wordpress.com\/2011\/07\/23\/java-persistence-api-a-quick-intro\/\">Java Persistence API: a quick intro\u2026<\/a> from our<a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\"> JCG partner<\/a> Steve Robinson at <a href=\"http:\/\/footyntech.wordpress.com\/\">Footy &#8216;n&#8217; Tech<\/a> blog<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping facility for managing relational data in Java applications. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Here, we are using JPA to perform create, delete, update and delete methods, as &hellip;<\/p>\n","protected":false},"author":7,"featured_media":1240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[198,1028],"class_list":["post-736","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jpa","tag-enterprise-java-2","tag-jpa"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JPA CRUD Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping\" \/>\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-crud-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JPA CRUD Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-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=\"2012-11-11T19:48:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-27T12:53:26+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=\"Ilias Tsagklis\" \/>\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=\"Ilias Tsagklis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 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-crud-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/\"},\"author\":{\"name\":\"Ilias Tsagklis\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e\"},\"headline\":\"JPA CRUD Example\",\"datePublished\":\"2012-11-11T19:48:31+00:00\",\"dateModified\":\"2019-02-27T12:53:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/\"},\"wordCount\":266,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"keywords\":[\"enterprise java\",\"jpa\"],\"articleSection\":[\"jpa\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/\",\"name\":\"JPA CRUD Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"datePublished\":\"2012-11-11T19:48:31+00:00\",\"dateModified\":\"2019-02-27T12:53:26+00:00\",\"description\":\"This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-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-crud-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 CRUD 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\/ca18b1aa108e3bfadf717e563e0a7a6e\",\"name\":\"Ilias Tsagklis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg\",\"caption\":\"Ilias Tsagklis\"},\"description\":\"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.\",\"sameAs\":[\"http:\/\/www.iliastsagklis.com\/\",\"https:\/\/www.linkedin.com\/in\/iliastsagklis\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/ilias-tsagklis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JPA CRUD Example - Java Code Geeks","description":"This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping","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-crud-example\/","og_locale":"en_US","og_type":"article","og_title":"JPA CRUD Example - Java Code Geeks","og_description":"This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-11-11T19:48:31+00:00","article_modified_time":"2019-02-27T12:53:26+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":"Ilias Tsagklis","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ilias Tsagklis","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/"},"author":{"name":"Ilias Tsagklis","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e"},"headline":"JPA CRUD Example","datePublished":"2012-11-11T19:48:31+00:00","dateModified":"2019-02-27T12:53:26+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/"},"wordCount":266,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","keywords":["enterprise java","jpa"],"articleSection":["jpa"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/","name":"JPA CRUD Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","datePublished":"2012-11-11T19:48:31+00:00","dateModified":"2019-02-27T12:53:26+00:00","description":"This is an example of how to perform CRUD functionality in JPA. The Java Persistence API provides Java developers with an object\/relational mapping","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jpa\/jpa-crud-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-crud-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 CRUD 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\/ca18b1aa108e3bfadf717e563e0a7a6e","name":"Ilias Tsagklis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg","caption":"Ilias Tsagklis"},"description":"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.","sameAs":["http:\/\/www.iliastsagklis.com\/","https:\/\/www.linkedin.com\/in\/iliastsagklis"],"url":"https:\/\/examples.javacodegeeks.com\/author\/ilias-tsagklis\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/736","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\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=736"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/736\/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=736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}