首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >嵌入对象的问题:找不到具有逻辑名称的列

嵌入对象的问题:找不到具有逻辑名称的列
EN

Stack Overflow用户
提问于 2022-06-04 18:40:55
回答 1查看 86关注 0票数 0

我在一个MySQL数据库中有两个表。一个名为documento_tributario_electronico,另一个命名为detalle。

documento_Tributario_electronico表是:

代码语言:javascript
运行
复制
CREATE TABLE `documento_tributario_electronico` (
    `tipo_documento` INT(11) NOT NULL,
    `numero` BIGINT(20) NOT NULL,
    `fecha_emision` DATE NOT NULL DEFAULT 'curdate()',
    `indicador_no_rebaja` INT(11) NULL DEFAULT NULL,
    `tipo_despacho` INT(11) NULL DEFAULT NULL,
    `indicador_traslado` INT(11) NULL DEFAULT NULL,
    `tipo_impresion` VARCHAR(1) NOT NULL DEFAULT 'N' COLLATE 'utf8mb4_0900_ai_ci',
    `indicador_servicio` INT(11) NULL DEFAULT NULL,
    `indicador_montos_brutos` INT(11) NULL DEFAULT NULL,
    `tipo_transaccion_compra` INT(11) NULL DEFAULT NULL,
    `tipo_transaccion_venta` INT(11) NOT NULL DEFAULT '1',
    `forma_pago` INT(11) NOT NULL DEFAULT '2',
    `fecha_cancelacion` DATE NULL DEFAULT NULL,
    `monto_cancelado` BIGINT(20) NULL DEFAULT NULL,
    `saldo_insoluto` BIGINT(20) NULL DEFAULT NULL,
    `periodo_desde` DATE NULL DEFAULT NULL,
    `periodo_hasta` DATE NULL DEFAULT NULL,
    `medio_pago` VARCHAR(2) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `tipo_cuenta_pago` VARCHAR(2) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `cuenta_pago` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `banco_pago` VARCHAR(40) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `terminos_pago_codigo` VARCHAR(4) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `terminos_pago_glosa` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `terminos_pago_dias` INT(11) NULL DEFAULT NULL,
    `fecha_vencimiento` DATE NULL DEFAULT NULL,
    `tipo_factura_especial` INT(11) NULL DEFAULT NULL,
    `rut_empresa` VARCHAR(10) NOT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `rut_mandante` VARCHAR(10) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `rut_cliente` VARCHAR(10) NOT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `rut_solicitante` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `patente` VARCHAR(8) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `rut_transportista` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `rut_chofer` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `nombre_chofer` VARCHAR(30) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `direccion_destino` VARCHAR(70) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `comuna_destino` INT(11) NULL DEFAULT NULL,
    `ciudad_destino` INT(11) NULL DEFAULT NULL,
    `monto_neto` BIGINT(20) NULL DEFAULT NULL,
    `monto_exento` BIGINT(20) NULL DEFAULT NULL,
    `monto_base_faenamiento_carne` BIGINT(20) NULL DEFAULT NULL,
    `monto_base_margen_comercializacion` BIGINT(20) NULL DEFAULT NULL,
    `tasa_iva` FLOAT NULL DEFAULT '9.99',
    `iva` BIGINT(20) NULL DEFAULT NULL,
    `iva_propio` BIGINT(20) NULL DEFAULT NULL,
    `iva_terceros` BIGINT(20) NULL DEFAULT NULL,
    `iva_no_retenido` BIGINT(20) NULL DEFAULT NULL,
    `aplica_credito_especial_empresas_constructoras` TINYINT(4) NOT NULL DEFAULT '0',
    `monto_total` BIGINT(20) NOT NULL,
    `tipo_otra_moneda` VARCHAR(15) NULL DEFAULT '' COLLATE 'utf8mb4_0900_ai_ci',
    `factor_conversion_otra_moneda` FLOAT NULL DEFAULT NULL,
    PRIMARY KEY (`tipo_documento`, `numero`, `rut_empresa`) USING BTREE
)

detalle表是:

代码语言:javascript
运行
复制
CREATE TABLE `detalle` (
    `rut_empresa` VARCHAR(10) NOT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `tipo_documento` INT(11) NOT NULL,
    `numero` BIGINT(20) NOT NULL,
    `numero_detalle` INT(11) NOT NULL,
    `agenteRetenedor` INT(11) NOT NULL DEFAULT '0',
    `monto_base_faenamiento_carne` BIGINT(20) NULL DEFAULT NULL,
    `monto_base_margen_comercializacion` BIGINT(20) NULL DEFAULT NULL,
    `precio_unitario_neto_consumidor_final` BIGINT(20) NULL DEFAULT NULL,
    `codigo_producto` INT(11) NOT NULL,
    `descripcion_adicional` VARCHAR(1000) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
    `cantidad_referencia` FLOAT NULL DEFAULT NULL,
    `cantidad` FLOAT NOT NULL,
    `fecha_elaboracion` DATE NULL DEFAULT NULL,
    `fecha_vencimiento` DATE NULL DEFAULT NULL,
    `descuento_pct` FLOAT NULL DEFAULT NULL,
    `descuento_monto` BIGINT(20) NULL DEFAULT NULL,
    `recargo_pct` FLOAT NULL DEFAULT NULL,
    `recargo_monto` BIGINT(20) NULL DEFAULT NULL,
    `codigo_impuesto_retencion1` INT(11) NULL DEFAULT NULL,
    `codigo_impuesto_retencion2` INT(11) NULL DEFAULT NULL,
    `monto_item` BIGINT(20) NULL DEFAULT NULL,
    PRIMARY KEY (`rut_empresa`, `tipo_documento`, `numero`, `numero_detalle`) USING BTREE
)

另外,我正在用Spring和Lombok开发一个Spring应用程序。由于两个表都有复合主键,我不得不为每个实体的Id创建一个可嵌入的类。而且,从documento_tributario_electronico到detalle,有一对多的关系。

我为两个表实现了以下实体:

DocumentoTributarioElectronico实体:

代码语言:javascript
运行
复制
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Table(name="documento_tributario_electronico")
public class DocumentoTributarioElectronico implements Serializable {

    private static final long serialVersionUID = 1L;

    @EmbeddedId
    private DocumentoTributarioElectronicoPK id;
    
    @ManyToOne(fetch=FetchType.LAZY)
    @MapsId("rutEmpresa")
    private Empresa emisor;
    
    @OneToOne(fetch=FetchType.LAZY)
    @MapsId("tipoDocumento")
    private TipoDocumento tipoDocumento;
    
    @Column(name="fecha_emision", nullable=false)
    @Temporal(TemporalType.DATE)
    private Date fechaEmision;
    
    @Column(name="indicador_no_rebaja", nullable=true)
    private Integer indicadorNoRebaja;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="tipo_despacho", referencedColumnName="codigo", nullable=true)
    private TipoDespacho tipoDespacho;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="indicador_traslado", referencedColumnName="codigo", nullable=true)
    private IndicadorTraslado indicadorTraslado;
    
    @Column(name="tipo_impresion", length=1, columnDefinition="VARCHAR(1) DEFAULT 'N'")
    private String tipoImpresion;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="indicador_servicio", referencedColumnName="codigo", nullable=true)
    private IndicadorServicio indicadorServicio;
    
    @Column(name="indicador_montos_brutos", nullable=true)
    private Integer indicadorMontosBrutos;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="tipo_transaccion_compra", referencedColumnName="codigo", nullable=true)
    private TipoTransaccionCompra tipoTransaccionCompra;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="tipo_transaccion_venta", referencedColumnName="codigo", columnDefinition="INT(11) DEFAULT 1")
    private TipoTransaccionVenta tipoTransaccionVenta;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="forma_pago", referencedColumnName="codigo", columnDefinition="INT(11) DEFAULT 2")
    private FormaPago formaPago;
    
    @Column(name="fecha_cancelacion", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fechaCancelacion;
    
    @Column(name="monto_cancelado", nullable=true)
    private Long montoCancelado;
    
    @Column(name="saldo_insoluto", nullable=true)
    private Long saldoInsoluto;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="documentoTributarioElectronico")
    private List<MontoPago> montosPago;
    
    @Column(name="periodo_desde", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date periodoDesde;
    
    @Column(name="periodo_hasta", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date periodoHasta;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="medio_pago", referencedColumnName="codigo", nullable=true)
    private MedioPago medioPago;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="tipo_cuenta_pago", referencedColumnName="codigo", nullable=true)
    private TipoCuentaPago tipoCuentaPago;
    
    @Column(name="cuenta_pago", length=20, nullable=true)
    private String cuentaPago;
    
    @Column(name="banco_pago", length=40, nullable=true)
    private String bancoPago;
    
    @Column(name="terminos_pago_codigo", length=4, nullable=true)
    private String terminosPagoCodigo;
    
    @Column(name="terminos_pago_glosa", length=100, nullable=true)
    private String terminosPagoGlosa;
    
    @Column(name="terminos_pago_dias", nullable=true)
    private Integer terminosPagoDias;
    
    @Column(name="fecha_vencimiento", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fechaVencimiento;
    
    @Column(name="rut_mandante", length=10, nullable=true)
    private String rutMandante;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="rut_cliente", referencedColumnName="rut", nullable=false)
    private Cliente cliente;
    
    @Column(name="rut_solicitante", length=10, nullable=true)
    private String rutSolicitante;
    
    @Column(name="patente", length=8, nullable=true)
    private String patente;
    
    @Column(name="rut_transportista", length=10, nullable=true)
    private String rutTransportista;
    
    @Column(name="rut_chofer", length=10, nullable=true)
    private String rutChofer;
    
    @Column(name="nombre_chofer", length=30, nullable=true)
    private String nombreChofer;
    
    @Column(name="direccion_destino", length=70, nullable=true)
    private String direccionPostal;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ciudad_destino", referencedColumnName="codigo", nullable=true)
    private Ciudad ciudadPostal;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="comuna_destino", referencedColumnName="codigo", nullable=true)
    private Comuna comunaPostal;
    
    @Column(name="monto_neto", nullable=true)
    private Long montoNeto;
    
    @Column(name="monto_exento", nullable=true)
    private Long montoExento;
    
    @Column(name="monto_base_faenamiento_carne", nullable=true)
    private Long montoBaseFaenamientoCarne;
    
    @Column(name="monto_base_margen_comercializacion", nullable=true)
    private Long montoBaseMargenComercializacion;
    
    @Column(name="tasa_iva", nullable=true)
    private Float tasaIva;
    
    @Column(name="iva", nullable=true)
    private Long iva;
    
    @Column(name="iva_propio", nullable=true)
    private Long ivaPropio;
    
    @Column(name="iva_terceros", nullable=true)
    private Long ivaTerceros;
    
    @Column(name="iva_no_retenido", nullable=true)
    private Long ivaNoRetenido;
    
    @Column(name="aplica_credito_especial_empresas_constructoras", columnDefinition="TINYINT(1) DEFAULT 0")
    private Boolean aplicaCreditoEspecialEmpresasConstructoras;
    
    @Column(name="monto_total", nullable=false)
    private Long montoTotal;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="tipo_otra_moneda", referencedColumnName="codigo", nullable=true)
    private Moneda tipoOtraMoneda;
    
    @Column(name="factor_conversion_otra_moneda", nullable=true)
    private Float factorConversionOtraMoneda;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="dte")
    private List<Detalle> detalles;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="dte")
    private List<SubtotalInformativo> subtotales;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="dte")
    private List<DescuentoRecargoGlobal> descuentosRecargosGlobales;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="dte")
    private List<Referencia> referencias;
    
}

Detalle实体:

代码语言:javascript
运行
复制
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name="detalle")
public class Detalle implements Serializable {

    private static final long serialVersionUID = 1L;
    
    @EmbeddedId
    private DetallePK id;
    
    @ManyToOne(fetch=FetchType.LAZY)
    @MapsId("dteId")
    private DocumentoTributarioElectronico dte;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<Subcantidad> subcantidades;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<DetalleOtraMoneda> detalleOtraMoneda;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<DistribucionDescuento> distribucionDescuento;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<DistribucionRecargo> distribucionRecargo;
    
    @Column(name="agente_retenedor", columnDefinition="INT(11) DEFAULT 0")
    private Integer agenteRetenedor;
    
    @Column(name="monto_base_faenamiento_carne", nullable=true)
    private Long montoBaseFaenamientoCarne;
    
    @Column(name="monto_base_margen_comercializacion", nullable=true)
    private Long montoBaseMargenComercializacion;
    
    @Column(name="precio_unitario_neto_consumidor_final", nullable=true)
    private Long precioUnitarioNetoConsumidorFinal;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="rut_empresa", referencedColumnName="rut_empresa")
    @JoinColumn(name="codigo_producto", referencedColumnName="codigo")
    private Producto producto;

    @Column(name="descripcion_adicional", length=1000, nullable=true)
    private String descripcionAdicional;
    
    @Column(name="cantidad_referencia", nullable=true)
    private Float cantidadReferencia;
    
    @Column(name="cantidad", nullable=false)
    private Float cantidad;
    
    @Column(name="fecha_elaboracion", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fechaElaboracion;
    
    @Column(name="fecha_vencimiento", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fechaVencimiento;
    
    @Column(name="descuento_pct", nullable=true)
    private Float descuentoPct;
    
    @Column(name="descuento_monto", nullable=true)
    private Long descuentoMonto;
    
    @Column(name="recargo_pct", nullable=true)
    private Float recargoPct;
    
    @Column(name="recargo_monto", nullable=true)
    private Long recargoMonto;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="codigo_impuesto_retencion1", referencedColumnName="codigo", nullable=true)
    ImpuestoRetencion impuestoRetencion1;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="codigo_impuesto_retencion2", referencedColumnName="codigo", nullable=true)
    ImpuestoRetencion impuestoRetencion2;
    
    @Column(name="monto_item", nullable=false)
    private Long montoItem;
    
    @ManyToMany(fetch=FetchType.LAZY, mappedBy="detallesPorSubtotal")
    private List<SubtotalInformativo> subtotales;
}

现在注意如何为每个实体的id定义可嵌入类:

DocumentoTributarioElectronicoPK类:

代码语言:javascript
运行
复制
@Embeddable
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class DocumentoTributarioElectronicoPK implements Serializable {

    private static final long serialVersionUID = 1L;
    
    @Column(name="rut_empresa", length=10, nullable=false)
    private String rutEmpresa;
    
    @Column(name="tipo_documento", nullable=false)
    private Integer tipoDocumento;
    
    @Column(name="numero", nullable=false)
    private Long numero;
}

DetallePK类

代码语言:javascript
运行
复制
@Embeddable
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class DetallePK implements Serializable {

    private static final long serialVersionUID = 1L;
    
    @Embedded
    private DocumentoTributarioElectronicoPK dteId;
    
    @Column(name="numero_detalle", nullable=false)
    private Integer numeroDetalle;
}

当我运行应用程序时,我会得到以下错误:

代码语言:javascript
运行
复制
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to find column with logical name tipo_documento in table detalle

但是列tipo_documento是在detalle!

我想知道这两个实体到底出了什么问题。

提前感谢

编辑:请考虑这样一个事实,即DetallePK类也嵌入到其他实体中,这些实体指向从每个表到detalle具有多到一个关系的表。

编辑:根据请求,以下是referencedColumnName="tipo_documento“当前出现的情况。它们在另一个实体类中。

代码语言:javascript
运行
复制
@ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "detalles_subtotal", inverseJoinColumns = {
            @JoinColumn(name = "rut_empresa", referencedColumnName = "rut_empresa"),
            @JoinColumn(name = "tipo_documento", referencedColumnName = "tipo_documento"),
            @JoinColumn(name = "numero", referencedColumnName = "numero"),
            @JoinColumn(name = "numero_detalle", referencedColumnName = "numero_detalle") }, joinColumns = {
                    @JoinColumn(name = "rut_empresa", referencedColumnName = "rut_empresa"),
                    @JoinColumn(name = "tipo_documento", referencedColumnName = "tipo_documento"),
                    @JoinColumn(name = "numero", referencedColumnName = "numero"),
                    @JoinColumn(name = "numero_subtotal", referencedColumnName = "numero_subtotal") })
    private List<Detalle> detallesPorSubtotal;

编辑:根据请求,我遵循了这个链接中问题的公认答案:https://stackoverflow.com/a/31389777/1429387

这给了我另一个错误:

代码语言:javascript
运行
复制
 org.hibernate.MappingException: Repeated column in mapping for entity: cl.maraneda.neopos.entities.Detalle column: rut_empresa (should be mapped with insert="false" update="false")

显然,将rut_empresa映射为不可插入的选项不是一种选择。

EN

回答 1

Stack Overflow用户

发布于 2022-06-05 05:10:50

解决了

在我的头一次又一次地撞在墙上之后,我想到了一个解决办法:

  1. I必须将表documento_tributario_electronico中的rut_empresa列重命名为rut_emisor,以避免混淆。
  2. 添加@MapsId注释以指定要为@OneToOne映射的嵌入id类中的属性,或者在我的示例中,实体之间的@ManyToOne关系(在我的例子中,从Detalle映射到@OneToOne)是正确的如果可嵌入类没有直接定义使用该可嵌入类实例作为实体id的实体类的某些列,或者应用程序抛出异常,抱怨数据库中实际上存在一个列,则使用@MapsId是不够的。在我的示例中,无论是detalle实体类还是DetallePK可嵌入类都不使用@Column注释直接定义指向数据库中Detalle表中的rut_emisor、tipo_documento和数字列的属性,因为它们是在DetallePK类中声明为@Embedded属性的DocumentoTributarioElectronicoPK对象中定义的。此外,还必须确保没有其他

  1. 注释,它们指向实体类E 227中的所有其他属性中的相同列,否则将引发异常。要避免@JoinColumn出现这个问题,您必须遵循以下步骤:
    • 如果在冲突实体与另一个实体之间的@ManyToOne@OneToOne关系中只有一个冲突列,则只需使用@MapsId注释来指定指向列
    • 的另一个实体中的属性,如果在@ManyToOne@OneToOne中存在从冲突实体到另一个实体的两个或多个冲突列,则只需使用@MapsId注释,所有这些都是在一个@Embeddable类中定义的,该类的实例被用作@EmbeddedId,您必须使用值"name\_value\_of\_the\_@Entity_annotation.name\@EmbeddedId\_object}“的@MapsId注释。在我的示例中,Detalle实体与另一个名为Producto的实体具有具有此特性的@OneToOne关系,冲突列是在名为ProductoPK的可嵌入类中定义的,其实例被用作Producto中名为id的嵌入id属性。由于我没有为Producto实体指定名称,在Detalle中的冲突属性中的@MapsId注释的值是annotation.

,在冲突实体到另一个实体的@OneToMany关系上至少有一个相冲突的列,您必须在另一个具有指定@JoinColumns (如果需要的话使用@MapsId )的实体中定义一个@ManyToOne属性,在冲突实体的冲突属性中,将mappedBy参数添加到@OneToMany

得到的包含所有更正的Detalle类如下:

代码语言:javascript
运行
复制
package cl.maraneda.neopos.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cl.maraneda.neopos.entities.pk.DetallePK;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name="detalle")
public class Detalle implements Serializable {

    private static final long serialVersionUID = 1L;
    
    @EmbeddedId
    private DetallePK id;
    
    @ManyToOne(fetch=FetchType.LAZY)
    @MapsId("dteId")
    @JoinColumn(name = "tipo_documento", referencedColumnName = "tipo_documento")
    @JoinColumn(name = "numero", referencedColumnName = "numero")
    @JoinColumn(name = "rut_empresa", referencedColumnName = "rut_emisor")
    private DocumentoTributarioElectronico dte;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<Subcantidad> subcantidades;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<DetalleOtraMoneda> detalleOtraMoneda;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<DistribucionDescuento> distribucionDescuento;
    
    @OneToMany(fetch=FetchType.LAZY, mappedBy="detalle")
    private List<DistribucionRecargo> distribucionRecargo;
    
    @Column(name="agente_retenedor", columnDefinition="INT(11) DEFAULT 0")
    private Integer agenteRetenedor;
    
    @Column(name="monto_base_faenamiento_carne", nullable=true)
    private Long montoBaseFaenamientoCarne;
    
    @Column(name="monto_base_margen_comercializacion", nullable=true)
    private Long montoBaseMargenComercializacion;
    
    @Column(name="precio_unitario_neto_consumidor_final", nullable=true)
    private Long precioUnitarioNetoConsumidorFinal;
    
    @OneToOne(fetch=FetchType.LAZY)
    @MapsId("producto.id")
    private Producto producto;

    @Column(name="descripcion_adicional", length=1000, nullable=true)
    private String descripcionAdicional;
    
    @Column(name="cantidad_referencia", nullable=true)
    private Float cantidadReferencia;
    
    @Column(name="cantidad", nullable=false)
    private Float cantidad;
    
    @Column(name="fecha_elaboracion", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fechaElaboracion;
    
    @Column(name="fecha_vencimiento", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fechaVencimiento;
    
    @Column(name="descuento_pct", nullable=true)
    private Float descuentoPct;
    
    @Column(name="descuento_monto", nullable=true)
    private Long descuentoMonto;
    
    @Column(name="recargo_pct", nullable=true)
    private Float recargoPct;
    
    @Column(name="recargo_monto", nullable=true)
    private Long recargoMonto;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="codigo_impuesto_retencion1", referencedColumnName="codigo", nullable=true)
    ImpuestoRetencion impuestoRetencion1;
    
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="codigo_impuesto_retencion2", referencedColumnName="codigo", nullable=true)
    ImpuestoRetencion impuestoRetencion2;
    
    @Column(name="monto_item", nullable=false)
    private Long montoItem;
    
    @ManyToMany(fetch=FetchType.LAZY, mappedBy="detallesPorSubtotal")
    private List<SubtotalInformativo> subtotales;   
}

感谢所有回答我的问题并试图帮助我的人。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72502241

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档