{"id":264899,"date":"2015-09-03T21:34:02","date_gmt":"2015-09-03T17:34:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=264899"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=264899","title":{"rendered":"\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438 Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u0447\u0430\u0441\u0442\u044c 1: JPA \u0438 Hibernate \u0432 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430\u0445"},"content":{"rendered":"<p>     \t<a href=\"http:\/\/habrahabr.ru\/post\/265061\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/527\/1a7\/430\/5271a74306fa45a79d15e1b15c93a63d.png\" alt=\"image\"\/><\/a><\/p>\n<p>  \u0417\u043d\u0430\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b JPA? \u0410 Hibernate? \u0410 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c? <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412 \u0447\u0435\u043c \u0441\u043c\u044b\u0441\u043b \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 &#39;\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438 Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430&#39;<\/b><\/p>\n<div class=\"spoiler_text\">\u0417\u0430 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0438 \u043f\u043b\u0430\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0442 \u0441\u0438\u043b\u044b 10-20% \u043e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0438\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043a \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043d\u0443\u043b\u044f. \u0417\u0430\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u0440\u0430\u0442\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u0435\u0445 \u0438\u043b\u0438 \u0438\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 (\u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043e\u043a) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438. <\/p><\/div>\n<\/div>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u0434\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u0443\u0447\u0430\u0442\u044c JPA \u0438 Hibernate (\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b), \u0438 \u0434\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u0443\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0435\u0442 JPA \u0438 Hibernate (\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439). \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c \u043a\u0442\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e, \u0433\u0434\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e JPA \u0438 Hibernate (\u0438\u043b\u0438 \u0441\u0430\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e).<\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0442\u0430\u043a \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b: \u0435\u0441\u043b\u0438 \u0432\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u2014 \u043f\u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 1 \u0431\u0430\u043b\u043b, \u0435\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u2014 0.5 \u0431\u0430\u043b\u043b. \u0412\u0435\u0437\u0434\u0435 \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0446\u0438\u0442\u0430\u0442\u044b \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u043d\u043e \u0438\u0437-\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 Oracle \u043d\u0435 \u043c\u043e\u0433\u0443 \u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0446\u0438\u0442\u0430\u0442\u044b \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438). <\/p>\n<h3>\u041e\u0431\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/h3>\n<p>  <\/p>\n<ul>\n<li>\u0412\u043e\u043f\u0440\u043e\u0441 1. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 JPA? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPA (Java Persistence API) \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f Java EE \u0438 Java SE, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c java \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u0421\u0430\u043c\u0430 Java \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 JPA, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0442 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 (\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0438 \u043d\u0435\u0442). \u042d\u0442\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f java \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (ORM \u0441\u0438\u0441\u0442\u0435\u043c), \u043d\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432 Java \u043c\u0438\u0440\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The JPA (Java Persistence API) is the specification of the Java API for the management of persistence and object\/relational mapping with Java EE and Java SE. The technical objective of this work is to provide an object\/relational mapping facility for the Java application developer using a Java domain model to manage a relational database.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li>\u0412\u043e\u043f\u0440\u043e\u0441 2. \u0412 \u0447\u0435\u043c \u0435\u0451 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 JPA \u043e\u0442 Hibernate? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">Hibernate \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (JPA 2.1). \u0414\u0430\u0436\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f, \u043f\u043e\u0447\u0442\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0434\u0435-\u0444\u0430\u043a\u0442\u043e. \u0422\u043e \u0435\u0441\u0442\u044c JPA \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438 API, \u0430 Hibernate \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u044d\u0442\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u0432\u043f\u0440\u043e\u0447\u0435\u043c \u0443 Hibernate (\u043a\u0430\u043a \u0438 \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 JPA) \u0435\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 JPA (\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 JPA).  <\/div>\n<\/div>\n<p>  <\/li>\n<li>\u0412\u043e\u043f\u0440\u043e\u0441 3. \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c JPA c noSQl \u0431\u0430\u0437\u0430\u043c\u0438? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u043e\u043e\u0431\u0449\u0435, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f JPA \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 java \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u044f\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0434\u043b\u044f noSql \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445: <a href=\"https:\/\/github.com\/impetus-opensource\/Kundera\/wiki\">Kundera<\/a>, <a href=\"http:\/\/www.datanucleus.org\/\">DataNucleus<\/a>, ObjectDB \u0438 \u0440\u044f\u0434 \u0434\u0440\u0443\u0433\u0438\u0445. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 nosql \u0431\u0430\u0437\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.   <\/div>\n<\/div>\n<p>  <\/li>\n<li>\u0412\u043e\u043f\u0440\u043e\u0441 4. \u0412 \u0447\u0435\u043c \u0435\u0451 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 JPA \u043e\u0442 JDO? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPA (Java Persistence API) \u0438 Java Data Objects (JDO) \u0434\u0432\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f java \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 JPA \u0441\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u0430\u0445, \u0442\u043e JDO \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 ORM \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0431\u0430\u0437 \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c JPA \u043a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 \u0440\u0435\u043b\u044f\u0442\u0438\u0432\u0438\u0441\u0442\u0441\u043a\u0438\u0445 \u0431\u0430\u0437 \u0447\u0430\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 JDO, \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0442\u043e\u043c \u0447\u0442\u043e API \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442. \u0422\u0430\u043a\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u00ab\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438\u00bb \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u2014 \u0435\u0441\u043b\u0438 JPA \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <a href=\"http:\/\/www.jcp.org\">JSR<\/a>, \u0442\u043e JDO \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0441\u044f \u043a\u0430\u043a <a href=\"http:\/\/www.jcp.org\">JSR<\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/db.apache.org\/jdo\/\">Apache JDO<\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0438 API \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"http:\/\/db.apache.org\/jdo\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.   <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 5. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Entity? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">Entity \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 (persistent domain object). \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e entity \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u043b\u0438 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0435ntity.<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An entity is a lightweight persistent domain object.<br \/>  The primary programming artifact is the entity class. An entity class may make use of auxiliary classes<br \/>  that serve as helper classes or that are used to represent the state of the entity.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 6. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 Entity \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435 Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (non-entity classes)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u043e\u0436\u0435\u0442<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.1<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Entities may extend non-entity classes\u2026  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 7. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 Entity \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.1<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Entities may extend non-entity classes as well as entity classes\u2026  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 8. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u043d\u0435 Entity \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 Entity \u043a\u043b\u0430\u0441\u0441\u0430? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0418 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.1<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Entities may extend non-entity classes as well as entity classes, and non-entity classes may extend entity classes.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 9. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 Entity \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u043e\u0436\u0435\u0442, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 Entity, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.11.1<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An abstract class can be specified as an entity. An abstract entity differs from a concrete entity only in<br \/>  that it cannot be directly instantiated. An abstract entity is mapped as an entity and can be the target of<br \/>  queries (which will operate over and\/or retrieve instances of its concrete subclasses).  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 10. \u041a\u0430\u043a\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f JPA \u043a Entity \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c (\u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0448\u0435\u0441\u0442\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1) Entity \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 Entity \u0438\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 XML \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 JPA,<br \/>  2) Entity \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c public \u0438\u043b\u0438 protected \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438), <br \/>  3) Entity \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (top-level class),<br \/>  4) Entity \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c enum \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c,<br \/>  5) Entity \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c (final class), <br \/>  6) Entity \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0435 (persistent final methods or persistent final instance variables),<br \/>  7) \u0415\u0441\u043b\u0438 Entity \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 (detached object), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (through a remote interface), \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c Serializable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, <br \/>  8) \u041f\u043e\u043b\u044f Entity \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0441\u0430\u043c\u043e\u0433\u043e Entity \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c \u044d\u0442\u043e\u0442 Entity. \u0422\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c (getter\/setter \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0432 Entity \u043a\u043b\u0430\u0441\u0441\u0435),<br \/>  9) Enity \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0442\u043e \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u044d\u0442\u043e\u0433\u043e Enity \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.1 and 2.4<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">1. The entity class must be annotated with the Entity annotation or denoted in the XML descriptor as an<br \/>  entity.<br \/>  2. The entity class must have a no-arg constructor. The entity class may have other constructors as well.<br \/>  3. The no-arg constructor must be public or protected.<br \/>  4. The entity class must be a top-level class. An enum or interface must not be designated as an entity.<br \/>  5. The entity class must not be final. No methods or persistent instance variables of the entity class may be<br \/>  final.<br \/>  6. If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the<br \/>  entity class must implement the Serializable interface.<br \/>  7. Entities support inheritance, polymorphic associations, and polymorphic queries.<br \/>  8. Both abstract and concrete classes can be entities. Entities may extend non-entity classes as well as<br \/>  entity classes, and non-entity classes may extend entity classes.<br \/>  10. The persistent state of an entity is represented by instance variables, which may correspond to JavaBeans<br \/>  properties. An instance variable must be directly accessed only from within the methods of the<br \/>  entity by the entity instance itself. Instance variables must not be accessed by clients of the entity. The<br \/>  state of the entity is available to clients only through the entity\u2019s methods\u2014i.e., accessor methods (getter\/setter<br \/>  methods) or other business methods.<br \/>  \u2026<br \/>  2.4 Primary Keys and Entity Identity<br \/>  Every entity must have a primary key.   <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 11. \u041a\u0430\u043a\u0438\u0435 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0443 Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0418\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (access) \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPA \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0442\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0441 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (property), \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0438\u043b\u0435 JavaBeans, \u043b\u0438\u0431\u043e \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 (field), \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 (instance variables). \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0438\u043f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0431\u043e property access \u0438\u043b\u0438 field access. <\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.2<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The persistent state of an entity is accessed by the persistence provider runtime[1] either via JavaBeans<br \/>  style property accessors (\u201cproperty access\u201d) or via instance variables (\u201cfield access\u201d). Whether persistent<br \/>  properties or persistent fields or a combination of the two is used for the provider\u2019s access to a<br \/>  given class or entity hierarchy is determined as described in Section 2.3, \u201cAccess Type\u201d.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 12. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 Entity \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 JPA? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPA \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0442\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0441 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (property), \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0438\u043b\u0435 JavaBeans, \u043b\u0438\u0431\u043e \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 (field), \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 (instance variables). \u041e\u0431\u0430 \u0442\u0438\u043f\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 Entity \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 Entity \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.2<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The persistent state of an entity is accessed by the persistence provider runtime[1] either via JavaBeans<br \/>  style property accessors (\u201cproperty access\u201d) or via instance variables (\u201cfield access\u201d). Whether persistent<br \/>  properties or persistent fields or a combination of the two is used for the provider\u2019s access to a<br \/>  given class or entity hierarchy is determined as described in Section 2.3, \u201cAccess Type\u201d.<br \/>  Terminology Note: The persistent fields and properties of an entity class are generically<br \/>  referred to in this document as the \u201cattributes\u201d of the class.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 13. \u041a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 Entity \u043a\u043b\u0430\u0441\u0441\u0430 (\u043f\u043e\u043b\u044f\u0445 \u0438\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0443 Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432: <br \/>  1. \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438 \u0438\u0445 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 Java,<br \/>  2. \u0441\u0442\u0440\u043e\u043a\u0438, <br \/>  3. \u043b\u044e\u0431\u044b\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b Java (\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 Serializable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441),<br \/>  4. enums; <br \/>  5. entity types; <br \/>  6. embeddable \u043a\u043b\u0430\u0441\u0441\u044b<br \/>  7. \u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432 1-6<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.2<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The persistent fields or properties of an entity may be of the following types: Java primitive types; java.lang.String; other Java serializable types (including wrappers of the primitive types, java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar[5], java.sql.Date, java.sql.Time, java.sql.Timestamp, byte[], Byte[], char[], Character[], and user-defined types that implement the Serializable<br \/>  interface); enums; entity types; collections of entity types; embeddable classes (see Section 2.5); collections of basic and embeddable types (see Section 2.6).  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 14. \u041a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 Entity \u043a\u043b\u0430\u0441\u0441\u0430 (\u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0439 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043c\u043e\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445? \u0410 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u0432\u0442\u043e\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (generated primary keys)?<br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447:<br \/>  1. \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438 \u0438\u0445 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 Java,<br \/>  2. \u0441\u0442\u0440\u043e\u043a\u0438, <br \/>  3. BigDecimal \u0438 BigInteger,<br \/>  4. java.util.Date \u0438 java.sql.Date, <\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u0432\u0442\u043e\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (generated primary keys) \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b <br \/>  1. \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b, <\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442.\u0435. \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u043c (not portable), <\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.4<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">A simple primary key or a field or property of a composite primary key should be one of the following types: any Java primitive type; any primitive wrapper type; java.lang.String; java.util.Date; java.sql.Date; java.math.BigDecimal; java.math.BigInteger\u2026 Entities whose primary keys use types other than these will not be portable. If generated primary keys are used, only integral types will be portable.   <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0421\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b JPA<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 15. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 (Embeddable) \u043a\u043b\u0430\u0441\u0441? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 (Embeddable) \u043a\u043b\u0430\u0441\u0441 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432. Entity \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0442\u0430\u043a \u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0442\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u0430\u043a \u043a\u043b\u044e\u0447\u0438 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f map. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 Entity \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 Entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432). \u0412 \u0446\u0435\u043b\u043e\u043c, \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0449\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 Entity, \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e JPA \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0432 Entity \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442.<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.5<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An entity may use other fine-grained classes to represent entity state. Instances of these classes, unlike<br \/>  entity instances, do not have persistent identity of their own. Instead, they exist only as part of the state<br \/>  of the entity to which they belong. An entity may have collections of embeddables as well as single-valued<br \/>  embeddable attributes. Embeddables may also be used as map keys and map values. Embedded<br \/>  objects belong strictly to their owning entity, and are not sharable across persistent entities. Attempting<br \/>  to share an embedded object across entities has undefined semantics.   <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 16. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 (Embeddable) \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 (Embeddable) \u043a\u043b\u0430\u0441\u0441? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430, \u043c\u043e\u0436\u0435\u0442<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.5<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An embeddable class may be used to represent the state of another embeddable class.An embeddable class (including an embeddable class within another embeddable class) may contain a collection of a basic type or other embeddable class.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 17. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 (Embeddable) \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438 (relationship) \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 Entity \u0438\u043b\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 Entity? \u0415\u0441\u043b\u0438 \u043c\u043e\u0436\u0435\u0442, \u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 (relationship)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u043e\u0436\u0435\u0442, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u043b\u0438 \u043a\u043b\u044e\u0447 map&#8217;\u044b.<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.5<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An embeddable class may contain a relationship to an entity or collection of entities. Since instances of embeddable classes themselves have no persistent identity, the relationship from the referenced entity is to the entity that contains the embeddable instance(s) and not to the embeddable itself. An embeddable class that is used as an embedded id or as a map key must not contain such a relationship.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 18. \u041a\u0430\u043a\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f JPA \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043a \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c (Embeddable) \u043a\u043b\u0430\u0441\u0441\u0430\u043c? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1. \u0422\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u0442\u0435\u043c \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0447\u0442\u043e Entity \u043a\u043b\u0430\u0441\u0441\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0431\u044b\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 Entity (\u0441\u043c. \u0432\u043e\u043f\u0440\u043e\u0441 10),<br \/>  2. Embeddable \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 Embeddable \u0438\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 XML \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 JPA,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.5<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Embeddable classes must adhere to the requirements specified in Section 2.1 for entities with the exception that embeddable classes are not annotated as Entity. Embeddable classes must be annotated as Embeddable or denoted in the XML descriptor as such.   <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 19. \u041a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0441\u0432\u044f\u0437\u0435\u0439 (relationship) \u043c\u0435\u0436\u0434\u0443 Entity \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 (\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0432\u043e\u0441\u0435\u043c\u044c \u0442\u0438\u043f\u043e\u0432, \u043b\u0438\u0431\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0438\u043f\u0430 \u0441\u0432\u044f\u0437\u0435\u0439, \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0449\u0451 \u043d\u0430 \u0434\u0432\u0430 \u0432\u0438\u0434\u0430)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0438\u043f\u0430 \u0441\u0432\u044f\u0437\u0435\u0439 <br \/>  1. OneToOne (\u0441\u0432\u044f\u0437\u044c \u043e\u0434\u0438\u043d \u043a \u043e\u0434\u043d\u043e\u043c\u0443, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 Entity \u043c\u043e\u0436\u0435\u0442 \u0441\u0432\u044f\u0437\u0430\u043d \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0441 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u0433\u043e Entity ), <br \/>  2. OneToMany (\u0441\u0432\u044f\u0437\u044c \u043e\u0434\u0438\u043d \u043a\u043e \u043c\u043d\u043e\u0433\u0438\u043c, \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 Entity \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0446\u0435\u043b\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439 \u0434\u0440\u0443\u0433\u0438\u0445 Entity), <br \/>  3. ManyToOne (\u0441\u0432\u044f\u0437\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u043a \u043e\u0434\u043d\u043e\u043c\u0443, \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c \u0434\u043b\u044f OneToMany), <br \/>  4. ManyToMany (\u0441\u0432\u044f\u0437\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e \u043c\u043d\u043e\u0433\u0438\u043c)<\/p>\n<p>  \u041a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0449\u0451 \u043d\u0430 \u0434\u0432\u0430 \u0432\u0438\u0434\u0430:<br \/>  1. Bidirectional <br \/>  2. Unidirectional<\/p>\n<p>  Bidirectional \u2014 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0432\u044f\u0437\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443 \u0432\u0441\u0435\u0445 Entity, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 OneToOne A-B \u0432 Entity A \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Entity B, \u0432 Entity B \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Entity A, Entity A \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 (\u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u043e\u0433\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 A \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u043e B, \u043d\u043e \u043d\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442).<\/p>\n<p>  Undirectional- \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0432\u044f\u0437\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 OneToOne A-B \u0442\u043e\u043b\u044c\u043a\u043e \u0443 Entity A \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Entity B, \u0443 Entity B \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 A \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. <\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.9<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Relationships among entities may be one-to-one, one-to-many, many-to-one, or many-to-many. Relationships are polymorphic.<br \/>  If there is an association between two entities, one of the following relationship modeling annotations must be applied to the corresponding persistent property or field of the referencing entity: OneToOne, OneToMany, ManyToOne, ManyToMany. For associations that do not specify the target type (e.g.,<br \/>  where Java generic types are not used for collections), it is necessary to specify the entity that is the target of the relationship.[19] Equivalent XML elements may be used as an alternative to these mapping annotations.<br \/>  These annotations mirror common practice in relational database schema modeling. The use of the relationship modeling annotations allows the object\/relationship mapping of associations to the relational database schema to be fully defaulted, to provide an ease-of-development facility. This is<br \/>  described in Section 2.10, \u201cRelationship Mapping Defaults\u201d.<br \/>  Relationships may be bidirectional or unidirectional. A bidirectional relationship has both an owning side and an inverse (non-owning) side. A unidirectional relationship has only an owning side. The owning side of a relationship determines the updates to the relationship in the database, as described in section 3.2.4.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 20. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Mapped Superclass? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">Mapped Superclass \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f Entity, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u043d\u043e\u0442\u0430\u0446\u0438\u0438 JPA, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0430\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Entity, \u0435\u043c\u0443 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f Entity (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430). \u0422\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 EntityManager \u0438\u043b\u0438 Query. \u0422\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 MappedSuperclass \u0438\u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 xml \u0444\u0430\u0439\u043b\u0435. <\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.2<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?utf8=%E2%9C%93&amp;q=javax.persistence.MappedSuperclass&amp;type=Code&amp;ref=searchresults\">github<\/a>: <a href=\"https:\/\/github.com\/redime\/redime.persistence\/blob\/bb231a53b1efa8fce4794135eb67c0fecbd37de1\/persistence\/src\/main\/java\/redime\/persistence\/SharedEntity.java\">1<\/a> <a href=\"https:\/\/github.com\/ebean-orm\/avaje-ebeanorm-agent\/blob\/97f41c41537cf7a7fd3c46b5dffe2418946dc078\/src\/test\/java\/test\/model\/PBase.java\">2<\/a> <a href=\"https:\/\/github.com\/ChunkyDev\/Chunky2\/blob\/6829872d160a0bf70e295652790dc236e71b263f\/src\/main\/java\/org\/getchunky\/chunkyapi\/object\/ChunkyFlagged.java\">3<\/a><\/p>\n<p>  Example: Concrete class as a mapped superclass  <\/p>\n<pre><code class=\"java\">@MappedSuperclass public class Employee {  @Id protected Integer empId;  @Version protected Integer version;  @ManyToOne @JoinColumn(name=&quot;ADDR&quot;)  protected Address address;  public Integer getEmpId() { ... }  public void setEmpId(Integer id) { ... }  public Address getAddress() { ... }  public void setAddress(Address addr) { ... } } \/\/ Default table is FTEMPLOYEE table @Entity public class FTEmployee extends Employee {  \/\/ Inherited empId field mapped to FTEMPLOYEE.EMPID  \/\/ Inherited version field mapped to FTEMPLOYEE.VERSION  \/\/ Inherited address field mapped to FTEMPLOYEE.ADDR fk  \/\/ Defaults to FTEMPLOYEE.SALARY protected Integer salary; public FTEmployee() {} public Integer getSalary() { ... } public void setSalary(Integer salary) { ... } } @Entity @Table(name=&quot;PT_EMP&quot;) @AssociationOverride(name=&quot;address&quot;, joincolumns=@JoinColumn(name=&quot;ADDR_ID&quot;)) public class PartTimeEmployee extends Employee {  \/\/ Inherited empId field mapped to PT_EMP.EMPID  \/\/ Inherited version field mapped to PT_EMP.VERSION  \/\/ address field mapping overridden to PT_EMP.ADDR_ID fk  @Column(name=&quot;WAGE&quot;)  protected Float hourlyWage;  public PartTimeEmployee() {}  public Float getHourlyWage() { ... }  public void setHourlyWage(Float wage) { ... } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An entity may inherit from a superclass that provides persistent entity state and mapping information,<br \/>  but which is not itself an entity. Typically, the purpose of such a mapped superclass is to define state<br \/>  and mapping information that is common to multiple entity classes.<br \/>  A mapped superclass, unlike an entity, is not queryable and must not be passed as an argument to<br \/>  EntityManager or Query operations. Persistent relationships defined by a mapped superclass must<br \/>  be unidirectional.<br \/>  Both abstract and concrete classes may be specified as mapped superclasses. The MappedSuperclass<br \/>  annotation (or mapped-superclass XML descriptor element) is used to designate a<br \/>  mapped superclass.<br \/>  A class designated as a mapped superclass has no separate table defined for it. Its mapping information<br \/>  is applied to the entities that inherit from it.<br \/>  A class designated as a mapped superclass can be mapped in the same way as an entity except that the<br \/>  mappings will apply only to its subclasses since no table exists for the mapped superclass itself. When<br \/>  applied to the subclasses, the inherited mappings will apply in the context of the subclass tables. Mapping<br \/>  information can be overridden in such subclasses by using the AttributeOverride and<br \/>  AssociationOverride annotations or corresponding XML elements.<br \/>  All other entity mapping defaults apply equally to a class designated as a mapped superclass.<br \/>  The following example illustrates the definition of a concrete class as a mapped superclass.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 21. \u041a\u0430\u043a\u0438\u0435 \u0442\u0440\u0438 \u0442\u0438\u043f\u044b \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u043f\u0438\u043d\u0433\u0430 (Inheritance Mapping Strategies) \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 JPA? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 JPA \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0442\u0440\u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u043f\u0438\u043d\u0433\u0430 (Inheritance Mapping Strategies), \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a JPA \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u043c\u0438 Entity: <br \/>  1) \u043e\u0434\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0430 \u0432\u0441\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f (<b>a single table per class hierarchy<\/b>) \u2014 \u0432\u0441\u0435 enity, \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u0430 entity \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430 <b>\u201cdiscriminator column\u201d<\/b>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c entity Animals c \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438-\u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c\u0438 Cats \u0438 Dogs, \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0432\u0441\u0435 entity \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Animals, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 animalType \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abcat\u00bb \u0438\u043b\u0438 \u00abdog\u00bb. <b>\u041c\u0438\u043d\u0443\u0441\u043e\u043c<\/b> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e \u0447\u0442\u043e \u0432 \u043e\u0431\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432-\u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432-\u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 animals \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043b\u0430\u0437\u0430\u043d\u044c\u044f \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443 \u043e\u0442 cats \u0438 \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u043f\u0435\u0441 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442\u044c \u0442\u0430\u043f\u043a\u0438 \u043e\u0442 dogs, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0442\u044c null \u0434\u043b\u044f dog \u0438 cat \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  2) \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f (<b>joined subclass strategy<\/b>) \u2014 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 enity \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0432\u043e\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 (\u043d\u0435 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u043e\u0432-\u043f\u0440\u0435\u0434\u043a\u043e\u0432) \u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0430 \u0432\u0441\u0435 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u043b\u0430\u0441\u0441\u0430-\u043f\u0440\u0435\u0434\u043a\u0430, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0432\u044f\u0437\u044c (relationships) \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 Animals (\u0441\u043c.\u0432\u044b\u0448\u0435), \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b animals, cats, dogs, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 cats \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043b\u0430\u0437\u0430\u043d\u044c\u044f, \u0432 dogs \u2014 \u043a\u043b\u044e\u0447 \u0438 \u0443\u043c\u0435\u0435\u0442 \u043b\u0438 \u043f\u0435\u0441 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442\u044c \u043f\u0430\u043b\u043a\u0443, \u0430 \u0432 animals \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 cats \u0438 dogs c \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <b>\u041c\u0438\u043d\u0443\u0441\u043e\u043c<\/b> \u0442\u0443\u0442 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 (join) \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. <\/p>\n<p>  3) \u043e\u0434\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (<b>table per concrete class strategy<\/b>) \u2014 \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0442.\u0435. \u0434\u043b\u044f cats \u0438 dogs (\u0441\u043c.\u0432\u044b\u0448\u0435) \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b cats \u0438 dogs \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u043c\u0435\u043b\u0438 \u043e\u0431\u0449\u0435\u0433\u043e \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441\u0430. <b>\u041c\u0438\u043d\u0443\u0441\u043e\u043c<\/b> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0445\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 (polymorphic relationships) \u0438 \u0442\u043e \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 sql \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 UNION \u0437\u0430\u043f\u0440\u043e\u0441\u0430. <\/p>\n<p>  \u0414\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <b>Inheritance<\/b> (\u0438\u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u043b\u043e\u043a\u0438 <br \/>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 2.12<\/a>, <a href=\"https:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/InheritanceType.html\">J7EE javadoc<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?l=java&amp;q=javax.persistence.InheritanceType&amp;type=Code&amp;utf8=%E2%9C%93\">github<\/a>: TABLE_PER_CLASS: <a href=\"https:\/\/github.com\/MaksimPrabarshchuk\/Maksim-Prabarshchuk-Group-1\/blob\/719386345e3fa5c72e56d67cd31707a22a59ebc3\/java-backend\/src\/main\/java\/by\/fly\/model\/Customer.java\">1<\/a> <a href=\"https:\/\/github.com\/AlazarG\/action-bazaar\/blob\/71ce1d0148e2169f7b02f904763a887d008af5b7\/chapter9\/src\/main\/java\/com\/actionbazaar\/listing24\/User.java\">2<\/a> <a href=\"https:\/\/github.com\/mrpvsilva\/projeto-sms-sender\/blob\/d2885ca9f5e79b8c77c5f2b7fe98ba93626202d6\/SIGA\/Dominio\/EnderecoCliente.java\">3<\/a>, JOINED:<a href=\"https:\/\/github.com\/kim2kim\/myshopnshare\/blob\/157f4c196eb284b1cc7f9ef50f38eac3e1a2f8a0\/mss-war\/src\/main\/java\/com\/myshopnshare\/core\/domain\/DirEntry.java\">1<\/a> <a href=\"https:\/\/github.com\/cebindani\/aulas-java\/blob\/861a48976e9e4d877889008ac36e439576069678\/2-JPA_Hibernate\/DojoAula3_DC\/src\/com\/dxt\/domain\/EmpresaPrivada.java\">2<\/a> <a href=\"https:\/\/github.com\/missy-project\/disco-model-impl\/blob\/4497e5da82c1abd6fcb9a612ea68160edf66dacc\/src\/main\/java\/org\/gesis\/dcterms\/ProvenanceStatement.java\">3<\/a> ,SINGLE_TABLE: <a href=\"https:\/\/github.com\/mrpvsilva\/projeto-sms-sender\/blob\/d2885ca9f5e79b8c77c5f2b7fe98ba93626202d6\/SIGA\/Dominio\/EnderecoCliente.java\">1<\/a> <a href=\"https:\/\/github.com\/reisrf\/INFNET-XPTO-SAB\/blob\/d51ad69fc27c963d5e5b2e40aa6eda52be179fd7\/SABModel\/ejbModule\/modelo\/TalaoCheque.java\">2<\/a> <a href=\"https:\/\/github.com\/itasyurt\/karaf\/blob\/b70e590d0f906db810e3ee672f533486b10b0305\/karaf-domain\/src\/main\/java\/org\/itasyurt\/karaf\/domain\/characteristic\/specification\/atomic\/AtomicCharacteristicSpecification.java\">3<\/a><\/p>\n<pre><code class=\"java\">@Entity @Inheritance(strategy=JOINED) public class Customer { ... } @Entity public class ValuedCustomer extends Customer { ... } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">There are three basic strategies that are used when mapping a class or class hierarchy to a relational<br \/>  database:<br \/>  \u2022 a single table per class hierarchy<br \/>  \u2022 a joined subclass strategy, in which fields that are specific to a subclass are mapped to a separate<br \/>  table than the fields that are common to the parent class, and a join is performed to instantiate<br \/>  the subclass.<br \/>  \u2022 a table per concrete entity class  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 22. \u041a\u0430\u043a\u0438\u0435 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 fetch \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0432 JPA \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 JPA \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 fetch \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438:<br \/>  1) LAZY \u2014 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044e,<br \/>  2) EAGER \u2014 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 11.1.6<\/a> <a href=\"https:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/FetchType.html\">J7EE javadoc<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The EAGER strategy is a requirement on the persistence provider runtime that the associated entity must<br \/>  be eagerly fetched. The LAZY strategy is a hint to the persistence provider runtime that the associated<br \/>  entity should be fetched lazily when it is first accessed. The implementation is permitted to eagerly<br \/>  fetch associations for which the LAZY strategy hint has been specified.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 Entity<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 23. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 EntityManager \u0438 \u043a\u0430\u043a\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">EntityManager \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 API \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 Enitity, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 JPA. \u041f\u043e \u0441\u0443\u0442\u0438 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JPA. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<br \/>  1) \u0414\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 Entity: persist (\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Entity \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 JPA), merge (\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435), remove (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f), refresh (\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445), detach (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 JPA), lock (\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Enity \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 thread),<br \/>  2) \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445: find (\u043f\u043e\u0438\u0441\u043a \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 Entity), createQuery, createNamedQuery, createNativeQuery, contains, createNamedStoredProcedureQuery, createStoredProcedureQuery<br \/>  3) \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 JPA: getTransaction, getEntityManagerFactory, getCriteriaBuilder, getMetamodel, getDelegate<br \/>  4) \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 EntityGraph: createEntityGraph, getEntityGraph<br \/>  4) \u041e\u0431\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 EntityManager \u0438\u043b\u0438 \u0432\u0441\u0435\u043c\u0438 Entities: close, isOpen, getProperties, setProperty, clear<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.1.1<\/a> <a href=\"https:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/EntityManager.html\">J7EE javadoc<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?utf8=%E2%9C%93&amp;q=javax.persistence.EntityManager&amp;type=Code&amp;ref=searchresults\">github<\/a>: <br \/>  1) \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: <a href=\"https:\/\/github.com\/magacoelho\/JEE.Persistence\/blob\/c6537dbdbc8056ccfe0ab6cbd5ae424fe510a7ae\/src\/main\/java\/es\/art83\/persistence\/jpa\/inheritance\/InheritanceMain.java\">persist 1<\/a>, <a href=\"https:\/\/github.com\/teb2000\/cookbooks\/blob\/f687eb48807c773e40fbdaace01361b7f0ac89d0\/cookbooks-java\/src\/test\/java\/no\/nuppers\/domain\/util\/Builder.java\">persist 2<\/a>, <a href=\"https:\/\/github.com\/miw-upm\/JEE\/blob\/ad7dcbf352692e47b19c95edb5f8fbd54b0665ab\/src\/main\/java\/es\/art83\/persistence\/jpa\/inheritance\/InheritanceMain.java\">persist 3<\/a> <a href=\"https:\/\/github.com\/thesyedr\/drapp_repository\/blob\/29458f1e8416277e7df833a36a6d351e3a2577a2\/drapp\/drapp-repository\/src\/main\/java\/com\/dr\/app\/repo\/repository\/GenericRepository.java\">merge<\/a>, <a href=\"https:\/\/github.com\/timoteosoutello\/testJavaProject\/blob\/f2e6011702d9511fed4ef62460d73bbacb4a23ff\/src\/br\/com\/bluesoft\/repository\/AbstractRepository.java\">remove<\/a>, <a href=\"https:\/\/github.com\/MATize\/smokee\/blob\/10286b26f24ae10ea0a4df74caf38a3115e85d83\/smokee-demo-webapp\/src\/main\/java\/at\/mse\/walchhofer\/demo\/business\/bilder\/boundary\/BildService.java\">detach<\/a>, <a href=\"https:\/\/github.com\/govindrgaikwad\/java_repo\/blob\/0c4ff666396e36e888c27eeec51de60b0b6228ec\/JAVA\/core-services\/src\/main\/java\/com\/tmg\/ebscore\/repository\/PackageRepositoryImpl.java\">detach 2<\/a><br \/>  2) \u043f\u043e\u0438\u0441\u043a: <a href=\"https:\/\/github.com\/md-chand\/springJpaMaven\/blob\/2e99d48d7ca41514e0a00df71a8edd0592f26865\/src\/main\/java\/com\/springmvc\/entitymanager\/AbstractManager.java\">find 1<\/a>, <a href=\"https:\/\/github.com\/worldofprasanna\/PharmaServer\/blob\/8d13e73bd161cf4d12973ab20cbb6f69fe31c1e6\/src\/main\/java\/com\/sparks\/pharma\/services\/DoctorService.java\">find 2<\/a>, <a href=\"https:\/\/github.com\/vverma2002\/JAVA-PROJECTS\/blob\/352893f5e6be3e349268951d8009b39352868bb1\/JAVA\/JPA\/JPA_SIMPLE_CRUD\/src\/com\/service\/DeleteEmployee.java\">find 3<\/a>, <a href=\"https:\/\/github.com\/larsenrobert\/dummylambdaJ-testing\/blob\/675bf4e3e9743a83db3802acaeb8d54e46e008ea\/src\/test\/java\/no\/robert\/lambda\/LambdaRepository.java\">createQuery 1<\/a> <a href=\"https:\/\/github.com\/albertgebien\/familia-gebien\/blob\/7d5c591f77fbd0c37315095399da97c7423402e5\/src\/main\/java\/br\/com\/familiagebien\/persistencia\/DAO.java\">createQuery 2<\/a> <a href=\"https:\/\/github.com\/barouniimen\/MonPFE\/blob\/1eb88ef58bc54b8d992bd3daea5f55e7264d5ddf\/platforme-pfe-ejb\/ejbModule\/org\/esprit\/gestion\/rapports\/config\/ResetIdGeneration.java\">createNativeQuery 1<\/a> <a href=\"https:\/\/github.com\/zbo\/zboDoSpring\/blob\/bf5ad2606e44925461e088904340002656ba5306\/zboDoSpringJpaData\/src\/main\/java\/userDomainNoSpring\/TableDroperImpl.java\">createNativeQuery 2<\/a> <a href=\"https:\/\/github.com\/racsoraul\/DarmanSG\/blob\/04341fe89967c5081902abb0c30aab883ef69d3f\/src\/main\/java\/com\/darmancatalogo\/darmansg\/util\/ActualizarBD.java\">createStoredProcedureQuery<\/a> <a href=\"https:\/\/github.com\/nielsfalk\/arquillianDemo\/blob\/e5f16494b7cefa139540f70a49e42a39c9894ce1\/src\/main\/java\/de\/niles\/MicroPostRepository.java\">createNamedQuery<\/a> <br \/>  3) \u0440\u0430\u0431\u043e\u0442\u0430 EntityGraph: <a href=\"https:\/\/github.com\/dirkweil\/whatsNewInJavaEe7\/blob\/228eedec525965e177ee1c8144237bba907fe5ce\/src\/main\/java\/de\/gedoplan\/demo\/persistence\/PublisherRepository.java\">1<\/a>, <a href=\"https:\/\/github.com\/DimitriDewaele\/FeesBoekWar\/blob\/2c1e1554417d771bda7e982a66937638ea66e830\/src\/main\/java\/be\/feesboek\/business\/message\/control\/MessageService.java\">2<\/a>, <a href=\"https:\/\/github.com\/rene-anderes\/edu\/blob\/f7a31407a0b51b430219016c396554ce51cbdff9\/jpa.cookbook.entitygraph\/src\/main\/java\/org\/anderes\/edu\/jpa\/cookbook\/RecipeRepository.java\">3<\/a> <a href=\"https:\/\/github.com\/DimitriDewaele\/FeesBoekWar\/blob\/2c1e1554417d771bda7e982a66937638ea66e830\/src\/main\/java\/be\/feesboek\/business\/message\/control\/MessageService.java\">4<\/a><\/p><\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Interface used to interact with the persistence context.<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.<\/p>\n<p>  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.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 24. \u041a\u0430\u043a\u0438\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (Entity Instance\u2019s Life Cycle) \u0432\u044b \u043c\u043e\u0436\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0423 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430: new, managed, detached, or removed. \u0418\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 <br \/>  1) new \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0449\u0451 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 commit&#8217;a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438,<br \/>  2) managed \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f JPA, \u0438\u043c\u0435\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438,<br \/>  3) detached \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d, \u043d\u043e \u043d\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f (\u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f) JPA,<br \/>  4) removed \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f JPA, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d \u043f\u043e\u0441\u043b\u0435 commit&#8217;a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.2<\/a> <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An entity instance can be characterized as being new, managed, detached, or removed.<\/p>\n<p>  \u2022 A new entity instance has no persistent identity, and is not yet associated with a persistence context.<br \/>  \u2022 A managed entity instance is an instance with a persistent identity that is currently associated with a persistence context.<br \/>  \u2022 A detached entity instance is an instance with a persistent identity that is not (or no longer) associated with a persistence context.<br \/>  \u2022 A removed entity instance is an instance with a persistent identity, associated with a persistence context, that will be removed from the database upon transaction commit.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 25. \u041a\u0430\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f persist \u043d\u0430 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 Entity new, \u0442\u043e \u043e\u043d \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 managed \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u0432 \u0431\u0430\u0437\u0443 \u043f\u0440\u0438 commit&#8217;\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 flush \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, <br \/>  2) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u0443\u0436\u0435 managed, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 Entity \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043d\u0430 managed, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439,<br \/>  3) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 removed, \u0442\u043e \u043e\u043d \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 managed,<br \/>  4) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 detached, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043a\u0438\u043d\u0443\u0442 exception \u0441\u0440\u0430\u0437\u0443 \u0438\u043b\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 commit&#8217;\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.2.2<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\u2022 If X is a new entity, it becomes managed. The entity X will be entered into the database at or<br \/>  before transaction commit or as a result of the flush operation.<br \/>  \u2022 If X is a preexisting managed entity, it is ignored by the persist operation. However, the persist<br \/>  operation is cascaded to entities referenced by X, if the relationships from X to these other<br \/>  entities are annotated with the cascade=PERSIST or cascade=ALL annotation element<br \/>  value or specified with the equivalent XML descriptor element.<br \/>  \u2022 If X is a removed entity, it becomes managed.<br \/>  \u2022 If X is a detached object, the EntityExistsException may be thrown when the persist<br \/>  operation is invoked, or the EntityExistsException or another PersistenceException<br \/>  may be thrown at flush or commit time.<br \/>  \u2022 For all entities Y referenced by a relationship from X, if the relationship to Y has been annotated<br \/>  with the cascade element value cascade=PERSIST or cascade=ALL, the persist<br \/>  operation is applied to Y  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 26. \u041a\u0430\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f remove \u043d\u0430 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 Entity new, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 Entity \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043d\u0430 managed, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, <br \/>  2) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 managed, \u0442\u043e \u0441\u0442\u0430\u0442\u0443\u0441 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 removed \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u043f\u0440\u0438 commit&#8217;\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0443\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 remove \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432),<br \/>  3) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 removed, \u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f,<br \/>  4) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 detached, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043a\u0438\u043d\u0443\u0442 exception \u0441\u0440\u0430\u0437\u0443 \u0438\u043b\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 commit&#8217;\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.2.3<\/a>   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\u2022 If X is a new entity, it is ignored by the remove operation. However, the remove operation is<br \/>  cascaded to entities referenced by X, if the relationship from X to these other entities is annotated<br \/>  with the cascade=REMOVE or cascade=ALL annotation element value.<br \/>  \u2022 If X is a managed entity, the remove operation causes it to become removed. The remove operation<br \/>  is cascaded to entities referenced by X, if the relationships from X to these other entities<br \/>  is annotated with the cascade=REMOVE or cascade=ALL annotation element value.<br \/>  \u2022 If X is a detached entity, an IllegalArgumentException will be thrown by the remove<br \/>  operation (or the transaction commit will fail).<br \/>  \u2022 If X is a removed entity, it is ignored by the remove operation.<br \/>  \u2022 A removed entity X will be removed from the database at or before transaction commit or as a<br \/>  result of the flush operation.   <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 27. \u041a\u0430\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f merge \u043d\u0430 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 detached, \u0442\u043e \u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 managed entity \u0441 \u0442\u0435\u043c \u0436\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u043b\u0438\u0431\u043e \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u043e\u0432\u044b\u0439 managed \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435,<br \/>  1) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 Entity new, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043d\u043e\u0432\u044b\u0439 managed entity, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430,<br \/>  2) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 managed, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f merge \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 Entity, \u0435\u0441\u043b\u0438 \u0438\u0445 \u0441\u0442\u0430\u0442\u0443\u0441 \u043d\u0435 managed,<br \/>  3) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 removed, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043a\u0438\u043d\u0443\u0442 exception \u0441\u0440\u0430\u0437\u0443 \u0438\u043b\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 commit&#8217;\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.2.7.1<\/a>   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\u2022 If X is a detached entity, the state of X is copied onto a pre-existing managed entity instance X&#8217;<br \/>  of the same identity or a new managed copy X&#8217; of X is created.<br \/>  \u2022 If X is a new entity instance, a new managed entity instance X&#8217; is created and the state of X is<br \/>  copied into the new managed entity instance X&#8217;.<br \/>  \u2022 If X is a removed entity instance, an IllegalArgumentException will be thrown by the<br \/>  merge operation (or the transaction commit will fail).<br \/>  \u2022 If X is a managed entity, it is ignored by the merge operation, however, the merge operation is<br \/>  cascaded to entities referenced by relationships from X if these relationships have been annotated<br \/>  with the cascade element value cascade=MERGE or cascade=ALL annotation.<br \/>  \u2022 For all entities Y referenced by relationships from X having the cascade element value<br \/>  cascade=MERGE or cascade=ALL, Y is merged recursively as Y&#8217;. For all such Y referenced<br \/>  by X, X&#8217; is set to reference Y&#8217;. (Note that if X is managed then X is the same object as<br \/>  X&#8217;.)<br \/>  \u2022 If X is an entity merged to X&#8217;, with a reference to another entity Y, where cascade=MERGE<br \/>  or cascade=ALL is not specified, then navigation of the same association from X&#8217; yields a<br \/>  reference to a managed object Y&#8217; with the same persistent identity as Y.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 28. \u041a\u0430\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f refresh \u043d\u0430 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 Entity managed, \u0442\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u043e\u0433\u043e Entity, \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 refresh \u0432\u0441\u0435\u0445 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432,<br \/>  2) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 new, removed \u0438\u043b\u0438 detached, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043a\u0438\u043d\u0443\u0442 exception,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.2.5<\/a>   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\u2022 If X is a managed entity, the state of X is refreshed from the database, overwriting changes<br \/>  made to the entity, if any. The refresh operation is cascaded to entities referenced by X if the<br \/>  relationship from X to these other entities is annotated with the cascade=REFRESH or<br \/>  cascade=ALL annotation element value.<br \/>  \u2022 If X is a new, detached, or removed entity, the IllegalArgumentException is thrown.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 29. \u041a\u0430\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f detach \u043d\u0430 Entity \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">1) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 Entity managed \u0438\u043b\u0438 removed, \u0442\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 Entity (\u0438 \u0432\u0441\u0435\u0445 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u043e-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432) \u0441\u0442\u0430\u043d\u0435\u0442 detached.<br \/>  2) \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 new \u0438\u043b\u0438 detached, \u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f,<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 3.2.6<\/a>   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\u2022 If X is a managed entity, the detach operation causes it to become detached. The detach operation<br \/>  is cascaded to entities referenced by X if the relationships from X to these other entities is<br \/>  annotated with the cascade=DETACH or cascade=ALL annotation element value. Entities<br \/>  which previously referenced X will continue to reference X.<br \/>  \u2022 If X is a new or detached entity, it is ignored by the detach operation.<br \/>  \u2022 If X is a removed entity, the detach operation causes it to become detached. The detach operation<br \/>  is cascaded to entities referenced by X if the relationships from X to these other entities is<br \/>  annotated with the cascade=DETACH or cascade=ALL annotation element value. Entities<br \/>  which previously referenced X will continue to reference X. Portable applications should not<br \/>  pass removed entities that have been detached from the persistence context to further EntityManager<br \/>  operations.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<\/ul>\n<h3>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 JPA<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 30. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f Basic?<br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><b>Basic<\/b> \u2014 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0442\u0438\u043f \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c fetch \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u043e\u043b\u044e \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438\u043b\u0438 \u043d\u0435\u0442. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?l=java&amp;q=javax.persistence.Basic&amp;type=Code&amp;utf8=%E2%9C%93\">github<\/a>: <a href=\"https:\/\/github.com\/luisollero\/HX\/blob\/0d39afbd0759b2064495e88f5a91cf60e6ce5492\/HX2-Persistence\/src\/test\/java\/com\/hx\/persistence\/model\/a\/A.java\">1<\/a> <a href=\"https:\/\/github.com\/rmhartog\/octopull\/blob\/9bd08b48311e89d6ff73bc36805ccb0737bcaf88\/src\/main\/java\/nl\/tudelft\/ewi\/sorcerers\/model\/Project.java\">2<\/a> <a href=\"https:\/\/github.com\/luisollero\/HX\/blob\/0d39afbd0759b2064495e88f5a91cf60e6ce5492\/HX2-Persistence\/src\/test\/java\/com\/hx\/persistence\/ddg\/User.java\">3<\/a> <a href=\"https:\/\/github.com\/KowalczykBartek\/web-spring-blogapp\/blob\/d8928038eb825749d321f2792be04cf58f57722d\/src\/main\/java\/com\/system\/models\/Description.java\">4<\/a>  <\/p>\n<pre><code class=\"java\">Example 1: @Basic protected String name; Example 2: @Basic(fetch=LAZY) protected String getName() { return name; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The Basic annotation is the simplest type of mapping to a database column. The Basic annotation<br \/>  can be applied to a persistent property or instance variable of any of the following types: Java primitive<br \/>  types, wrappers of the primitive types, java.lang.String, java.math.BigInteger,<br \/>  java.math.BigDecimal, java.util.Date, java.util.Calendar, java.sql.Date,<br \/>  java.sql.Time, java.sql.Timestamp, byte[], Byte[], char[], Character[],<br \/>  enums, and any other type that implements Serializable. A  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 31. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f Access? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (access type) \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 entity, \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441\u0430, embeddable \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a JPA \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c entity, \u043a\u0430\u043a \u043a \u043f\u043e\u043b\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u0430 (FIELD) \u0438\u043b\u0438 \u043a\u0430\u043a \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u043a\u043b\u0430\u0441\u0441\u0430 (PROPERTY), \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0433\u0435\u0442\u0435\u0440\u044b (getter) \u0438 \u0441\u0435\u0442\u0435\u0440\u044b (setter). <\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 11.1.1<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The Access annotation is used to specify an access type to be applied to an entity class, mapped superclass,or embeddable class, or to a specific attribute of such a class.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 32. \u041a\u0430\u043a\u043e\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0438 (override entity relationship) \u0438\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441\u0430, \u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 embeddable \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e embeddable \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 entity \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438: <br \/>  1. AttributeOverride \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u043b\u044f, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438,<br \/>  2. AttributeOverrides \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u043b\u044f, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u0441\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438,<br \/>  3. AssociationOverride \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438 (override entity relationship),<br \/>  4. AssociationOverrides \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 (multiple relationship),<\/p>\n<p>  <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1. Chapter 11.1.2-11.1.5<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The AssociationOverride annotation is used to override a mapping for an entity relationship.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b (AssociationOverride)<\/b><\/p>\n<div class=\"spoiler_text\">Example 1:  <\/p>\n<pre><code class=\"java\">@MappedSuperclass public class Employee {  @Id protected Integer id;  @Version protected Integer version;  @ManyToOne  protected Address address;  public Integer getId() { ... }  public void setId(Integer id) { ... }  public Address getAddress() { ... }  public void setAddress(Address address) { ... } } @Entity @AssociationOverride(name=&quot;address&quot;,  joinColumns=@JoinColumn(name=&quot;ADDR_ID&quot;)) public class PartTimeEmployee extends Employee { \/\/ address field mapping overridden to ADDR_ID foreign key  @Column(name=&quot;WAGE&quot;)  protected Float hourlyWage;  public Float getHourlyWage() { ... }  public void setHourlyWage(Float wage) { ... } } <\/code><\/pre>\n<p>  Example 2: Overriding of the mapping for the phoneNumbers relationship defined in the ContactInfo<br \/>  embeddable class.  <\/p>\n<pre><code class=\"java\">@Entity public class Employee {  @Id int id;  @AssociationOverride(  name=&quot;phoneNumbers&quot;,  joinTable=@JoinTable(  name=&quot;EMPPHONES&quot;,  joinColumns=@JoinColumn(name=&quot;EMP&quot;),  inverseJoinColumns=@JoinColumn(name=&quot;PHONE&quot;)  )  )  @Embedded ContactInfo contactInfo;  ... } @Embeddable public class ContactInfo {  @ManyToOne Address address; \/\/ Unidirectional  @ManyToMany(targetEntity=PhoneNumber.class) List phoneNumbers; } @Entity public class PhoneNumber {  @Id int number;  @ManyToMany(mappedBy=&quot;contactInfo.phoneNumbers&quot;)  Collection&lt;Employee&gt; employees; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 33. \u041a\u0430\u043a\u043e\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c JPA \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e Entity? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><b>Cacheable<\/b> \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0435\u0448\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (second-level cache) \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e Entity (\u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 JPA \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u0435\u0448\u0430 (second-level cache) \u0441\u0442\u043e\u044f\u0442 \u043a\u0430\u043a ENABLE_SELECTIVE \u0438\u043b\u0438 DISABLE_SELECTIVE, \u0441\u043c \u0432\u043e\u043f\u0440\u043e\u0441 32). \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u043e \u0443 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432, \u0442\u043e \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u043d\u0438\u0445 \u0442\u043e\u0436\u0435.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?l=java&amp;q=javax.persistence.Cacheable&amp;ref=searchresults&amp;type=Code&amp;utf8=%E2%9C%93\">github<\/a>: <a href=\"https:\/\/github.com\/ptahchiev\/hibernate-hsql-issue\/blob\/45a722ef9b47319cc9ee76c8e42fb4176e5dbda2\/src\/main\/java\/demo\/model\/CustomerModel.java\">1<\/a> <a href=\"https:\/\/github.com\/ptahchiev\/hibernate-hsql-issue\/blob\/45a722ef9b47319cc9ee76c8e42fb4176e5dbda2\/src\/main\/java\/demo\/model\/UserModel.java\">2<\/a> <a href=\"https:\/\/github.com\/ptahchiev\/hibernate-hsql-issue\/blob\/45a722ef9b47319cc9ee76c8e42fb4176e5dbda2\/src\/main\/java\/demo\/model\/CreditCardPaymentModel.java\">3<\/a> <a href=\"https:\/\/github.com\/dmatej\/Glassfish\/blob\/269e29ba90db6d9c38271f7acd2affcacf2416f1\/external\/modules\/eclipselink\/2.2.0\/jpa\/eclipselink.jpa.test\/src\/org\/eclipse\/persistence\/testing\/models\/jpa\/cacheable\/CacheableFalseEntity.java\">4<\/a>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The Cacheable annotation specifies whether an entity should be cached if caching is enabled when<br \/>  the value of the persistence.xml shared-cache-mode element is ENABLE_SELECTIVE or<br \/>  DISABLE_SELECTIVE. The value of the Cacheable annotation is inherited by subclasses; it can be<br \/>  overridden by specifying Cacheable on a subclass.  <\/p>\n<pre><code class=\"java\">@Target({TYPE}) @Retention(RUNTIME) public @interface Cacheable {  boolean value() default true; } <\/code><\/pre>\n<p>  Cacheable(false) means that the entity and its state must not be cached by the provider.<br \/>  If the shared-cache-mode element is not specified in the persistence.xml file and the<br \/>  javax.persistence.sharedCache.mode property is not specified when the entity manager<br \/>  factory for the persistence unit is created, the semantics of the Cacheable annotation are undefined.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 34. \u041a\u0430\u043a\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f basic \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 Entity \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438\/\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0445 \u0431\u0430\u0437\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c Entity boolean \u0442\u0438\u043f\u0430, \u043d\u043e \u0432 \u0431\u0430\u0437\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\"><b>Convert<\/b> \u0438 <b>Converts<\/b> \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 Basic \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 Entity \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f (Converts \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438). \u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 AttributeConverter \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b (\u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <b>Converter<\/b>.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/Convert.html\">Javadoc 7ee<\/a>.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?l=java&amp;q=javax.persistence.Convert+Convert&amp;ref=searchresults&amp;type=Code&amp;utf8=%E2%9C%93\">github<\/a>: <a href=\"https:\/\/github.com\/opengl8080-javaee-samples\/jpa\/blob\/e0666e330707ddaacc544a7f7ee5ad0ff590534e\/src\/java\/sample\/javaee\/jpa\/entity\/mapping\/LettyWhiterock.java\">1<\/a> <a href=\"https:\/\/github.com\/virgo47\/java-enum-conversion\/blob\/ef45ec4329d4ae6c823d1662609df94387100794\/src\/com\/github\/virgo47\/enumconv\/_1encapsulated\/SomeEntity.java\">2<\/a> <a href=\"https:\/\/github.com\/virgo47\/java-enum-conversion\/blob\/ef45ec4329d4ae6c823d1662609df94387100794\/src\/com\/github\/virgo47\/enumconv\/_1encapsulated\/SomeEntityTypeConverter.java\">3<\/a>  <\/p>\n<pre><code class=\"java\">Example 1:  Convert a basic attribute       @Converter      public class BooleanToIntegerConverter          implements AttributeConverter&lt;Boolean, Integer&gt; {  ... }       @Entity      public class Employee {          @Id long id;           @Convert(BooleanToIntegerConverter.class)           boolean fullTime;           ...      }        Example 2:  Auto-apply conversion of a basic attribute       @Converter(autoApply=true)      public class EmployeeDateConverter          implements AttributeConverter&lt;com.acme.EmployeeDate, java.sql.Date&gt; {  ... }       @Entity      public class Employee {          @Id long id;          ...          \/\/ EmployeeDateConverter is applied automatically          EmployeeDate startDate;      }        Example 3:  Disable conversion in the presence of an autoapply converter       @Convert(disableConversion=true)      EmployeeDate lastReview;        Example 4:  Apply a converter to an element collection of basic type       @ElementCollection      \/\/ applies to each element in the collection      @Convert(NameConverter.class)       List&lt;String&gt; names;        Example 5:  Apply a converter to an element collection that is a map or basic values.                    The converter is applied to the map value.       @ElementCollection      @Convert(EmployeeNameConverter.class)      Map&lt;String, String&gt; responsibilities;        Example 6:  Apply a converter to a map key of basic type       @OneToMany      @Convert(converter=ResponsibilityCodeConverter.class,                attributeName=&quot;key&quot;)      Map&lt;String, Employee&gt; responsibilities;        Example 7:  Apply a converter to an embeddable attribute       @Embedded      @Convert(converter=CountryConverter.class,                attributeName=&quot;country&quot;)      Address address;         Example 8:  Apply a converter to a nested embeddable attribute        @Embedded      @Convert(converter=CityConverter.class,                attributeName=&quot;region.city&quot;)      Address address;        Example 9:  Apply a converter to a nested attribute of an embeddable that is a map key                   of an element collection       @Entity public class PropertyRecord {           ...          @Convert(name=&quot;key.region.city&quot;,                    converter=CityConverter.class)          @ElementCollection          Map&lt;Address, PropertyInfo&gt; parcels;      }        Example 10: Apply a converter to an embeddable that is a map key for a relationship       @OneToMany      @Convert(attributeName=&quot;key.jobType&quot;,                converter=ResponsibilityTypeConverter.class)      Map&lt;Responsibility, Employee&gt; responsibilities;        Example 11: Override conversion mappings for attributes inherited from a mapped superclass       @Entity          @Converts({             @Convert(attributeName=&quot;startDate&quot;,                       converter=DateConverter.class),             @Convert(attributeName=&quot;endDate&quot;,                       converter=DateConverter.class)})      public class FullTimeEmployee extends GenericEmployee { ... } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 35. \u041a\u0430\u043a\u043e\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 JPA \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c Enitity \u0438\u043b\u0438 Mapped Superclass (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442.\u043f.)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f EntityListeners \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 Listener, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (\u0441allback methods) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 Entity \u0438\u043b\u0438 Mapped Superclass.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/EntityListeners.html\">Javadoc 7ee<\/a>.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/search?l=java&amp;q=javax.persistence.EntityListeners&amp;ref=searchresults&amp;type=Code&amp;utf8=%E2%9C%93\">github<\/a>: <a href=\"https:\/\/github.com\/baiyangliu\/wqt\/blob\/68d12521d92655ec8de34f632f55021b4561cf99\/src\/main\/java\/com\/itsmartreach\/wqt\/entity\/BaseEntity.java\">1<\/a> <a href=\"https:\/\/github.com\/Shadowru\/TheBox\/blob\/248ebee112b4f67fb5630c74d21c8bbb7f9df37a\/thebox-core\/src\/main\/java\/org\/shadow\/thebox\/core\/db\/entities\/security\/AuditableEntity.java\">2<\/a> <a href=\"https:\/\/github.com\/codeApeFromChina\/resource\/blob\/94f0d22469f38eb6d1a9b81f05cd016a4fa2989a\/frame_packages\/java_libs\/hibernate-distribution-3.6.10.Final\/project\/hibernate-entitymanager\/src\/test\/java\/org\/hibernate\/ejb\/test\/callbacks\/Rythm.java\">3<\/a>  <\/p>\n<pre><code class=\"java\">@Entity @EntityListeners(com.acme.AlertMonitor.class) public class Account { Long accountId; Integer balance; boolean preferred; @Id public Long getAccountId() { ... } ... public Integer getBalance() { ... } ...  @Transient \/\/ because status depends upon non-persistent context  public boolean isPreferred() { ... } ...  public void deposit(Integer amount) { ... }  public Integer withdraw(Integer amount) throws NSFException {... }  @PrePersist  protected void validateCreate() {  if (getBalance() &lt; MIN_REQUIRED_BALANCE)  throw new AccountException(&quot;Insufficient balance to open an account&quot;);  }  @PostLoad  protected void adjustPreferredStatus() {  preferred =  (getBalance() &gt;= AccountManager.getPreferredStatusLevel());  } } public class AlertMonitor {  @PostPersist  public void newAccountAlert(Account acct) {  Alerts.sendMarketingInfo(acct.getAccountId(), acct.getBalance()); } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 36. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b callback \u043c\u0435\u0442\u043e\u0434\u044b \u0432 JPA? \u041a \u043a\u0430\u043a\u0438\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 callback \u043c\u0435\u0442\u043e\u0434\u043e\u0432? \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0441\u0435\u043c\u044c callback \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (\u0438\u043b\u0438 \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 callback \u043c\u0435\u0442\u043e\u0434\u043e\u0432) <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">Callback \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u043b\u0443\u0436\u0430\u0442 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 Entity (\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f Entity \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 JPA), \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a entity \u043a\u043b\u0430\u0441\u0441\u0443, \u043a mapped superclass, \u0438\u043b\u0438 \u043a callback listener \u043a\u043b\u0430\u0441\u0441\u0443, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 EntityListeners (\u0441\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441). \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0435\u043c\u044c callback \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0438\u043c\u0435\u043d\u0430\u043c\u0438):<\/p>\n<p>  1) PrePersist<br \/>  2) PostPersist<br \/>  3) PreRemove<br \/>  4) PostRemove<br \/>  5) PreUpdate<br \/>  6) PostUpdate<br \/>  7) PostLoad<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/package-summary.html\">Javadoc 7ee<\/a> \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f JPA2.1 \u0433\u043b\u0430\u0432\u0430 3.5.2<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 github: <a href=\"http:\/\/javax.persistence.PrePersist\">PrePersist<\/a> <a href=\"https:\/\/github.com\/search?utf8=%E2%9C%93&amp;q=javax.persistence.PostPersist&amp;type=Code&amp;ref=searchresults\">PostPersist<\/a> <a href=\"https:\/\/github.com\/search?utf8=%E2%9C%93&amp;q=javax.persistence.PreRemove&amp;type=Code&amp;ref=searchresults\">PreRemove<\/a> <a href=\"https:\/\/github.com\/search?utf8=%E2%9C%93&amp;q=javax.persistence.PostUpdate&amp;type=Code&amp;ref=searchresults\">PostUpdate<\/a><br \/>  <a href=\"https:\/\/github.com\/search?utf8=%E2%9C%93&amp;q=javax.persistence.PostLoad&amp;type=Code&amp;ref=searchresults\">PostLoad<\/a>  <\/p>\n<pre><code class=\"java\">@Entity @EntityListeners(com.acme.AlertMonitor.class) public class Account { Long accountId; Integer balance; boolean preferred; @Id public Long getAccountId() { ... } ... public Integer getBalance() { ... } ...  @Transient \/\/ because status depends upon non-persistent context  public boolean isPreferred() { ... } ...  public void deposit(Integer amount) { ... }  public Integer withdraw(Integer amount) throws NSFException {... }  @PrePersist  protected void validateCreate() {  if (getBalance() &lt; MIN_REQUIRED_BALANCE)  throw new AccountException(&quot;Insufficient balance to open an account&quot;);  }  @PostLoad  protected void adjustPreferredStatus() {  preferred =  (getBalance() &gt;= AccountManager.getPreferredStatusLevel());  } } public class AlertMonitor {  @PostPersist  public void newAccountAlert(Account acct) {  Alerts.sendMarketingInfo(acct.getAccountId(), acct.getBalance()); } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 37. \u041a\u0430\u043a\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432\u044b\u0434\u0430\u0447\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439 Entity? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0436\u0438\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f OrderBy \u0438 OrderColumn<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/OrderBy.html\">Javadoc 7ee<\/a> \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f JPA2.1 \u0433\u043b\u0430\u0432\u0430 11.1.42<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Example 1: @Entity public class Course {  ...  @ManyToMany  @OrderBy(&quot;lastname ASC&quot;)  public List&lt;Student&gt; getStudents() {...};  ... } Example 2: @Entity public class Student {  ...  @ManyToMany(mappedBy=&quot;students&quot;)  @OrderBy \/\/ PK is assumed  public List&lt;Course&gt; getCourses() {...};  ... } Example 3: @Entity public class Person {  ...  @ElementCollection  @OrderBy(&quot;zipcode.zip, zipcode.plusFour&quot;)  public Set&lt;Address&gt; getResidences() {...};  ... } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 38. \u041a\u0430\u043a\u043e\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u0438 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 Entity \u0438\u0437 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 (property or field is not persistent)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0436\u0438\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f Transient <\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/Transient.html\">Javadoc 7ee<\/a> \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f JPA2.1 \u0433\u043b\u0430\u0432\u0430 11.1.52<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">@Entity public class Employee { @Id int id; @Transient User currentUser; ... } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<\/ul>\n<h3>\u0421\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b JPA<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 39. \u041a\u0430\u043a\u0438\u0435 \u0448\u0435\u0441\u0442\u044c \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a (lock) \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 JPA (\u0438\u043b\u0438 \u043a\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443 enum LockModeType \u0432 JPA)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0423 JPA \u0435\u0441\u0442\u044c \u0448\u0435\u0441\u0442\u044c \u0432\u0438\u0434\u043e\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u0438\u0445 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u0438 (\u043e\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e, \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e):<\/p>\n<p>  1) NONE \u2014 \u0431\u0435\u0437 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438<br \/>   2) OPTIMISTIC (\u0438\u043b\u0438 \u0441\u0438\u043d\u043e\u043d\u0438\u043c READ, \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u043e\u0442 JPA 1) \u2014 \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430,<br \/>   3) OPTIMISTIC_FORCE_INCREMENT (\u0438\u043b\u0438 \u0441\u0438\u043d\u043e\u043d\u0438\u043c WRITE, \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u043e\u0442 JPA 1) \u2014 \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0441 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438,<br \/>   4) PESSIMISTIC_READ \u2014 \u043f\u0435\u0441\u0441\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435,<br \/>   5) PESSIMISTIC_WRITE \u2014 \u043f\u0435\u0441\u0441\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c (\u0438 \u0447\u0442\u0435\u043d\u0438\u0435),<br \/>   6) PESSIMISTIC_FORCE_INCREMENT \u2014 \u043f\u0435\u0441\u0441\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c (\u0438 \u0447\u0442\u0435\u043d\u0438\u0435) \u0441 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438,<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.oracle.com\/javaee\/7\/api\/javax\/persistence\/LockModeType.html\">Javadoc 7ee<\/a> \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0438 \u043f\u0435\u0441\u0441\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 40. \u041a\u0430\u043a\u0438\u0435 \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 \u043a\u044d\u0448\u0435\u0439 (cache) \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0432 JPA \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPA \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0434\u0432\u0443\u0445 \u0432\u0438\u0434\u043e\u0432 \u043a\u044d\u0448\u0435\u0439 (cache):<br \/>  1) first-level cache (\u043a\u044d\u0448 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f) \u2014 \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438,<br \/>  2) second-level cache (\u043a\u044d\u0448 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f) \u2014 \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043e\u0434\u043d\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f. \u041f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 JPA \u043c\u043e\u0436\u0435\u0442, \u043d\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u044d\u0448\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u0422\u0430\u043a\u043e\u0439 \u0432\u0438\u0434 \u043a\u044d\u0448\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u0431\u043e\u0440\u043e\u0442\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, 3.9 Caching  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">This specification supports the use of a second-level cache by the persistence provider. The second-level<br \/>  cache, if used, underlies the persistence context, and is largely transparent to the application.<br \/>  A second-level cache is typically used to enhance performance. Use of a cache, however, may have<br \/>  consequences in terms of the up-to-dateness of the data seen by the application, resulting in \u201cstale<br \/>  reads\u201d. A stale read is defined as the reading of entities or entity state that is older than the point at<br \/>  which the persistence context was started.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 41. \u041a\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 second-level cache (\u043a\u044d\u0448\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f) \u0432 JPA \u0438\u043b\u0438 \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0448\u0438\u0442\u0435 \u043a\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 shared-cache-mode \u0438\u0437 persistence.xml? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPA \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u043f\u044f\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 shared-cache-mode \u0438\u0437 persistence.xml, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f second-level cache:<br \/>  1) ALL \u2014 \u0432\u0441\u0435 Entity \u043c\u043e\u0433\u0443\u0442 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0435\u0448\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, <br \/>  2) NONE \u2014 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 Entity, <br \/>  3) ENABLE_SELECTIVE \u2014 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 Entity, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f Cacheable(true) \u0438\u043b\u0438 \u0435\u0451 xml \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442, \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e,<br \/>  4) DISABLE_SELECTIVE \u2014 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 Entity, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0445 \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f Cacheable(false) \u0438\u043b\u0438 \u0435\u0451 xml \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442<br \/>  5) UNSPECIFIED \u2014 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 JPA \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0432\u043e\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f,<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, 3.9 Caching  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The shared-cache-mode element has five possible values: ALL, NONE, ENABLE_SELECTIVE,<br \/>  DISABLE_SELECTIVE, UNSPECIFIED.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 42. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 fetch \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043b\u044e\u0431\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 Entity \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (query) \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 (find), \u0442\u043e \u0435\u0441\u043b\u0438 \u0443 Enity \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0441 fetchType = LAZY, \u043d\u043e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0435\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c EAGER \u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 EntityGraph API, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043d \u0442\u0430\u043a: \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 NamedEntityGraph \u0434\u043b\u044f Entity, \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 EntityGraph \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c fetchType \u043d\u0430 EAGER, \u0430 \u043f\u043e\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 hits \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 find. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 fetchType \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 Entity \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 property \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f EntityGraph \u0432 hit:<br \/>  1) javax.persistence.fetchgraph \u2014 \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 EntityGraph \u043c\u0435\u043d\u044f\u044e\u0442 fetchType \u043d\u0430 EAGER, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430 LAZY<br \/>  2) javax.persistence.loadgraph \u2014 \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 EntityGraph \u043c\u0435\u043d\u044f\u044e\u0442 fetchType \u043d\u0430 EAGER, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0441\u0432\u043e\u0439 fetchType (\u0442\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 EntityGraph, fetchType \u0431\u044b\u043b EAGER, \u0442\u043e \u043e\u043d \u0438 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f EAGER)<\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NamedSubgraph \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c fetchType \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Entity. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c Entity \u0438 EntityGraph @Entity @Table(name = &quot;order&quot;) @Named(name = &quot;graphOrderItems&quot;,                 attributeNodes = @NamedAttributeNode(attributeNodes = &quot;items&quot;) ) public class Order implements Serializable {     ...     @OneToMany(mappedBy = &quot;order&quot;, fetch = FetchType.LAZY)    private Set&lt;Item&gt; items = new HashSet&lt;Item&gt;();     @OneToMany(mappedBy = &quot;order&quot;, fetch = FetchType.EAGER)    private Set&lt;Features&gt; features = new HashSet&lt;Features&gt;();     @OneToMany(mappedBy = &quot;order&quot;, fetch = FetchType.LAZY)    private Set&lt;Comment&gt; comments = new HashSet&lt;Comment&gt;();    ...  \/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0438\u0441\u043a\u0430 c javax.persistence.fetchgraph .. EntityGraph graph = this.em.getEntityGraph(&quot;graphOrderItems&quot;);  Map hints = new HashMap(); hints.put(&quot;javax.persistence.fetchgraph&quot;, graph);  return this.em.find(Order.class, orderId, hints); \/\/ items \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c fetchType = EAGER, \u0430 features \u0438 comments \u0438\u043c\u0435\u044e\u0442 fetchType = LAZY  \/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0438\u0441\u043a\u0430 c javax.persistence.loadgraph .. EntityGraph graph = this.em.getEntityGraph(&quot;graphOrderItems&quot;);  Map hints = new HashMap(); hints.put(&quot;javax.persistence.loadgraph&quot;, graph);  return this.em.find(Order.class, orderId, hints); \/\/ items \u0438 features \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c fetchType = EAGER, \u0430  comments \u0432\u0441\u0435 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 fetchType = LAZY <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, 3.7 EntityGraph<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">An entity graph can be used with the find method or as a query hint to override or augment FetchType semantics. The standard properties javax.persistence.fetchgraph and javax.persistence.loadgraph are used to specify such graphs to queries and find operations  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 43. \u041a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432 \u043a\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u044d\u0448\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0438\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 Entity \u0438\u0437 \u043a\u0435\u0448\u0430, \u0443\u0437\u043d\u0430\u0442\u044c \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043b\u0438 \u0434\u0430\u043d\u043d\u043e\u0435 Entity \u0438 \u0442.\u043f.)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u044d\u0448\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (second level cache) \u0432 JPA \u043e\u043f\u0438\u0441\u0430\u043d Cache \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043a\u044d\u0448\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (second level cache), \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c JPA, \u043a\u043e\u043d\u0435\u0447\u043d\u043e. \u041e\u0431\u044a\u0435\u043a\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 getCache \u0443 EntityManagerFactory.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, 7.10 Cache Interface  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The Cache interface provides basic functionality over the persistence provider\u2019s second level cache, if used.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 44. \u041a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 JPA (\u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e Entity \u0442\u0438\u043f\u0430\u0445, Embeddable \u0438 Managed \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0438 \u0442.\u043f.)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 JPA \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Metamodel. \u041e\u0431\u044a\u0435\u043a\u0442 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c getMetamodel \u0443 EntityManagerFactory \u0438\u043b\u0438 EntityManager.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, 5 Metamodel API  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">This specification provides a set of interfaces for dynamically accessing the metamodel corresponding<br \/>  to the managed classes of a persistence unit.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 45. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 JPQL (Java Persistence query language) \u0438 \u0447\u0435\u043c \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 SQL? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">JPQL (Java Persistence query language) \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a SQL, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u043c\u0435\u043d \u0438 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043c\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 Entity \u0438 \u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 Entity, \u0430 \u043d\u0435 \u043f\u043e\u043b\u0435\u0439 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 SQL \u0432 JPQL \u0435\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c (\u0441\u043c. \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441). \u0422\u0430\u043a\u0436\u0435 \u0432 JPQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u0432 SQL: \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a KEY (\u043a\u043b\u044e\u0447 Map&#8217;\u044b), VALUE (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Map&#8217;\u044b), TREAT (\u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441\u0430 \u043a \u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0443-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0443, downcasting), ENTRY \u0438 \u0442.\u043f.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, Chapter 4 Query Language  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The Java Persistence query language is a string-based query language used to define queries over entities<br \/>  and their persistent state. It enables the application developer to specify the semantics of queries in<br \/>  a portable way, independent of the particular database schema in use in an enterprise environment. The<br \/>  full range of the language may be used in both static and dynamic queries  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 46. \u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c (polymorphism) \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 JPQL (Java Persistence query language) \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u00ab\u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u00bb? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 SQL \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 JPQL \u0435\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a Entity \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u0442\u043e\u0433\u043e Entity, \u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432-\u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441 select * from Animal, \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b Animal, \u043d\u043e \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 Cat \u0438 Dog, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u044b \u043e\u0442 Animal). \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f TYPE \u0432 where \u0443\u0441\u043b\u043e\u0432\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 select * from Animal a where TYPE(a) IN (Animal, Cat) \u0443\u0436\u0435 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 Dog).<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, Chapter 4 Query Language  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Java Persistence queries are automatically polymorphic. An entity type expression can be used to restrict query polymorphism. The TYPE operator returns the exact type of the argument.  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 47. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Criteria API \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">Criteria API \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c JPQL (Java Persistence query language), \u043e\u0434\u043d\u0430\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445, \u0442\u043e \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"java\">CriteriaBuilder cb = ... CriteriaQuery&lt;Customer&gt; q = cb.createQuery(Customer.class); Root&lt;Customer&gt; customer = q.from(Customer.class); q.select(customer);   <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c JPA 2.1 specification, Chapter 6 Criteria API  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">The Java Persistence Criteria API is used to define queries through the construction of object-based<br \/>  query definition objects, rather than use of the string-based approach of the Java Persistence query language<br \/>  described in Chapter 4.   <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<\/ul>\n<h3>\u041e\u0442\u043b\u0438\u0447\u0438\u044f Hibernate 5.0 \u043e\u0442 JPA 2.1 \u0438\u043b\u0438 JPA 2.0 \u043e\u0442 JPA 2.1<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 48. \u0412 \u0447\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043a Entity \u0432 Hibernate, \u043e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a Entity, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 JPA (\u0441\u043c. \u0432\u043e\u043f\u0440\u043e\u0441 10)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">  1) \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d \u0431\u044b\u0442\u044c public \u0438\u043b\u0438 protected, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0445\u043e\u0442\u044f \u0431\u044b package \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 Java \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c, \u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c,<br \/>  2) JPA \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c final \u043a\u043b\u0430\u0441\u0441\u044b, Hibernate \u043b\u0438\u0448\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u0434\u043b\u044f \u043b\u0435\u043d\u0438\u0432\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0438\u0431\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438  <a href=\"http:\/\/habrahabr.ru\/users\/proxy\/\" class=\"user_link\">Proxy<\/a>(lazy=false), \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439  <a href=\"http:\/\/habrahabr.ru\/users\/proxy\/\" class=\"user_link\">Proxy<\/a>(proxyClass=\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.class) ) <\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.jboss.org\/hibernate\/orm\/5.0\/manual\/en-US\/html_single\/#persistent-classes-pojo\">hibernate 5.0 manual<\/a>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 49. \u041a\u0430\u043a\u0430\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u0432 Hibernate, \u043d\u043e \u043d\u0435\u0442 \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 JPA? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 JPA \u0432 Hibernate \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f implicit polymorphism.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/docs.jboss.org\/hibernate\/orm\/5.0\/manual\/en-US\/html_single\/#inheritance-strategies\">hibernate 5.0 manual<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/b><\/p>\n<div class=\"spoiler_text\">Hibernate supports the three basic inheritance mapping strategies:<\/p>\n<p>  table per class hierarchy<br \/>  table per subclass<br \/>  table per concrete class<br \/>  In addition, Hibernate supports a fourth, slightly different kind of polymorphism:<\/p>\n<p>  implicit polymorphism  <\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/li>\n<li> \u0412\u043e\u043f\u0440\u043e\u0441 50. \u041a\u0430\u043a\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 JPA 2.1 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 JPA 2.0 (\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u044f\u0442\u044c-\u0448\u0435\u0441\u0442\u044c \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439)? <br \/> \n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">  \u0412 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 JPA 2.1 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c: <br \/>  1) Entity Graphs \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f fetchType \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, <br \/>  2) Converters \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 Entity \u0432 \u043f\u043e\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445,<br \/>  3) DDL \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446, \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438 \u0441\u0445\u0435\u043c,<br \/>  4) Stored Procedures \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0438\u0437 JPA,<br \/>  5) Criteria Update\/Delete \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u044b\u0437\u043e\u0432\u0430 bulk updates \u0438\u043b\u0438 deletes, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Criteria API, <br \/>  6) Unsynchronized persistence contexts \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c SynchronizationType,<br \/>  7) \u041d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 JPQL\/Criteria API: \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b, generic database functions, join ON clause, \u0444\u0443\u043d\u043a\u0446\u0438\u044f TREAT,<br \/>  8) \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (named queries)<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0438 API \u0432 JPA 2.1:<br \/>  1) \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 EntityManager \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b createStoredProcedureQuery, isJoinedToTransaction \u0438 createQuery(CriteriaUpdate \u0438\u043b\u0438 CriteriaDelete)<br \/>  2) \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 AbstractQuery \u0441\u0442\u0430\u043b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 CommonAbstractCriteria, \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b CriteriaUpdate, CriteriaDelete \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 CommonAbstractCriteria,<br \/>  3) PersistenceProvider \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 generateSchema \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u044b,<br \/>  4) EntityManagerFactory \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043c\u0435\u0442\u043e\u0434\u044b addNamedQuery, unwrap, addNamedEntityGraph, createEntityManager (\u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c SynchronizationType)<br \/>  5) \u041f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 enum SynchronizationType, Entity Graphs, StoredProcedureQuery \u0438 AttributeConverter \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b,<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0441\u043c <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2_1-fr-eval-spec\/index.html\">Java Persistence 2.1<\/a> \u0438 <a href=\"http:\/\/download.oracle.com\/otndocs\/jcp\/persistence-2.0-fr-eval-oth-JSpec\/\">Java Persistence 2.0<\/a>  <\/div>\n<\/div>\n<p>  <\/li>\n<\/ul>\n<p>  P.S. \u0415\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443, \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0438\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b), \u0431\u0443\u0434\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0438\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u043b\u0438 \u0432 \u043b\u0438\u0447\u043a\u0443.   \t\t\t\t<\/p>\n<div class=\"polling\">\n<form action=\"\/json\/polling\/\" class=\"poll\" method=\"post\">\n<div class=\"poll_title\">\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u043d\u0430\u0431\u0440\u0430\u043b\u0438 \u0431\u0430\u043b\u043b\u043e\u0432 (\u0434\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432)?<\/div>\n<p>  \t\t<input type=\"hidden\" name=\"post_id\" value=\"265061\"\/> \t\t<input type=\"hidden\" name=\"polling_question_id\" value=\"13953\"\/>  \t\t<\/p>\n<table class=\"answer\">\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68575\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68575\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68575\">45-50<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68577\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68577\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68577\">40-44<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68579\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68579\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68579\">35-39<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68581\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68581\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68581\">30-34<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68583\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68583\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68583\">20-29<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68585\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68585\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68585\">10-19<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68587\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68587\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68587\">\u043c\u0435\u043d\u044c\u0448\u0435 10<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"radio\" id=\"vv68589\" \t\t\t\t\t\tclass=\"radio js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68589\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68589\">\u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u043b<\/label> \t\t\t\t<\/td>\n<\/tr>\n<\/table>\n<p class=\"total\">\u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u043e 69 \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u043e\u0441\u044c 70 \u0447\u0435\u043b\u043e\u0432\u0435\u043a.<\/p>\n<\/p><\/form>\n<form action=\"\/json\/polling\/\" class=\"poll\" method=\"post\">\n<div class=\"poll_title\">\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b?<\/div>\n<p>  \t\t<input type=\"hidden\" name=\"post_id\" value=\"265061\"\/> \t\t<input type=\"hidden\" name=\"polling_question_id\" value=\"13955\"\/>  \t\t<\/p>\n<table class=\"answer\">\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68591\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68591\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68591\">\u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68593\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68593\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68593\">\u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68595\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68595\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68595\">\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0437\u0443\u0431\u0440\u0435\u0436\u043a\u0443<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68597\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68597\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68597\">\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68599\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68599\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68599\">\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68601\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68601\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68601\">\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv68603\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"68603\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv68603\">\u0432\u0441\u0435 \u043f\u043b\u043e\u0445\u043e<\/label> \t\t\t\t<\/td>\n<\/tr>\n<\/table>\n<p class=\"total\">\u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u043e 29 \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u043e\u0441\u044c 88 \u0447\u0435\u043b\u043e\u0432\u0435\u043a.<\/p>\n<\/p><\/form>\n<p class=\"for_users_only_msg\">\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a href=\"https:\/\/habrahabr.ru\/auth\/login\/\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/p>\n<\/p><\/div>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/265061\/\"> http:\/\/habrahabr.ru\/post\/265061\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<a href=\"http:\/\/habrahabr.ru\/post\/265061\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/527\/1a7\/430\/5271a74306fa45a79d15e1b15c93a63d.png\" alt=\"image\"\/><\/a><\/p>\n<p>  \u0417\u043d\u0430\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b JPA? \u0410 Hibernate? \u0410 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c? <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412 \u0447\u0435\u043c \u0441\u043c\u044b\u0441\u043b \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 &#39;\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438 Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430&#39;<\/b><\/p>\n<div class=\"spoiler_text\">\u0417\u0430 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0438 \u043f\u043b\u0430\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0442 \u0441\u0438\u043b\u044b 10-20% \u043e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0438\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043a \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043d\u0443\u043b\u044f. \u0417\u0430\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u0440\u0430\u0442\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u0435\u0445 \u0438\u043b\u0438 \u0438\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 (\u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043e\u043a) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438. <\/p><\/div>\n<\/div>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u0434\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u0443\u0447\u0430\u0442\u044c JPA \u0438 Hibernate (\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b), \u0438 \u0434\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u0443\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0435\u0442 JPA \u0438 Hibernate (\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439). \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c \u043a\u0442\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e, \u0433\u0434\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e JPA \u0438 Hibernate (\u0438\u043b\u0438 \u0441\u0430\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-264899","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264899"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264899\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}