{"id":158,"date":"2015-11-25T16:33:31","date_gmt":"2015-11-25T16:33:31","guid":{"rendered":"http:\/\/apuntescreativos.890m.com\/?page_id=158"},"modified":"2015-11-25T16:33:31","modified_gmt":"2015-11-25T16:33:31","slug":"jpa","status":"publish","type":"page","link":"https:\/\/tunjasoporte.890m.com\/index.php\/jpa\/","title":{"rendered":"JPA"},"content":{"rendered":"<h2>Relaciones en JPA.<\/h2>\n<p>Maestros Detalles<\/p>\n<p><a href=\"http:\/\/localhost\/miblog\/wp-content\/uploads\/2015\/11\/er-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-159\" src=\"http:\/\/localhost\/miblog\/wp-content\/uploads\/2015\/11\/er-1.jpg\" alt=\"er\" width=\"735\" height=\"493\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Opci\u00f3n 1.<\/strong><\/p>\n<p>En este caso solo se relaciona la tabla 12 con la tabla 8, una relaci\u00f3n maestro detalle muy sencilla.\u00a0 Es unidireccional.<\/p>\n<p>&nbsp;<\/p>\n<pre>\n@Entity\n\n@Table(name = \"t12factura\")\n\npublic class Invoice extends EntityFather implements Serializable {\n\n@OneToMany\n\n@JoinColumn(name = \"a08factura\", referencedColumnName = \"a12id\")\n\nprivate List&lt;InvoicePayments&gt; listPayment = new ArrayList&lt;&gt;();\n\n&nbsp;\n<\/pre>\n<p>&nbsp;<\/p>\n<pre>\n@Entity\n\n@Table(name = \"t08tipopago_factura\")\n\npublic class InvoicePayments extends EntityFather implements Serializable {\n\n@Id\n\n@Column(name=\"a08factura\")\n\nprivate int idFactura;\n\n&nbsp;\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Opci\u00f3n 2.<\/strong><\/p>\n<p>Una segunda opci\u00f3n que cumple la misma funci\u00f3n de la opci\u00f3n 1 es la siguiente.<\/p>\n<p>&nbsp;<\/p>\n<pre>\n@Entity\n\n@Table(name = \"t12factura\")\n\npublic class Invoice extends EntityFather implements Serializable {\n\n@OneToMany(mappedBy=\"invoice\")\n\nprivate List&lt;InvoicePayments&gt; listPayment = new ArrayList&lt;&gt;();\n\n&nbsp;\n<\/pre>\n<p>&nbsp;<\/p>\n<pre>\n@Entity\n\n@Table(name = \"t08tipopago_factura\")\n\npublic class InvoicePayments extends EntityFather implements Serializable {\n\n@ManyToOne(fetch = FetchType.LAZY)\n\n@JoinColumn(name = \"a08factura\")\n\nprivate Invoice invoice = new Invoice();\n\n&nbsp;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Relaciones en JPA. Maestros Detalles &nbsp; Opci\u00f3n 1. En este caso solo se relaciona la tabla 12 con la tabla 8, una relaci\u00f3n maestro detalle muy sencilla.\u00a0 Es unidireccional. &nbsp; @Entity @Table(name = \u00abt12factura\u00bb) public class Invoice extends EntityFather implements Serializable { @OneToMany @JoinColumn(name = \u00aba08factura\u00bb, referencedColumnName = \u00aba12id\u00bb) private List&lt;InvoicePayments&gt; listPayment = new ArrayList&lt;&gt;(); [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-158","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/pages\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":0,"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/pages\/158\/revisions"}],"wp:attachment":[{"href":"https:\/\/tunjasoporte.890m.com\/index.php\/wp-json\/wp\/v2\/media?parent=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}