2017-03-13 14 views
0

私はこのモデルを持っており、エンティティを生成するためにjhipster 4とJDLStudioでモデルを作成しようとしています。1つのエンティティ上の2つのリレーション、jhipster

entity Cliente{ 
    nombre String, 
    apellido String, 
    celular String, 
    telefono String, 
    email String, 
    domicilio String, 
    colegio String 
} 

entity Modelo{ 
    imagen ImageBlob, 
    nombreModelo String, 
    colorVestido String, 
    observacion String 
} 

entity Medida{ 
    contornoBusto Double, 
    anchoPecho Double, 
    altoBusto Double, 
    bajoBusto Double, 
    alturaPinza Double, 
    separacionBusto Double, 
    talleDeltantero Double, 
    talleEspalda Double, 
    largoCorset Double, 
    costado Double, 
    hombro Double, 
    anchoHombro Double, 
    largoManga Double, 
    sisa Double, 
    cintura Double, 
    anteCadera Double, 
    cadera Double, 
    largoPollera Double, 
    fechaMedida LocalDate 
} 

entity Dominio{ 
    descripcion String 
} 
entity ValorDominio{ 
    descripcion String 
} 

entity Encargo{ 
    importeTotal Double, 
    fechaEncargo LocalDate, 
    fechaEntrega LocalDate, 
    detalleVestido String 
} 

entity Pago{ 
    fechaPago LocalDate, 
    importe Double, 
    detalle String, 
    numeroRecibo Integer 
} 


/** 
    * Relacion Una empresa tiene uno o muchos usuarios 
    */ 
relationship OneToMany { 
    Cliente{modelo(nombre)} to Modelo, 
    Cliente{medida(nombre)} to Medida, 
    Cliente{encargo(nombre)} to Encargo, 
    Encargo{pago} to Pago, 
    Dominio{valorDominio(descripcion)} to ValorDominio, 
    ValorDominio{tipoEvento(descripcion)} to Encargo, 
    ValorDominio{estado(descripcion)} to Encargo 
} 

/**relationship OneToOne{ 
*Cliente{user} to User{cliente} 
*} 
*/ 


paginate Cliente with infinite-scroll 

しかし、私は、アプリを実行したとき、私はこのエラー

Migration failed for change set classpath:config/liquibase/changelog/20170313030953_added_entity_Encargo.xml::20170313030953-1::jhipster: 
    Reason: liquibase.exception.DatabaseException: Duplicate column name 'valor_dominio_id' [Failed SQL: CREATE TABLE Clothes.encargo (id BIGINT AUTO_INCREMENT NOT NULL, importe_total DOUBLE NULL, fecha_encargo date NULL, fecha_entrega date NULL, detalle_vestido VARCHAR(255) NULL, cliente_id BIGINT NULL, valor_dominio_id BIGINT NULL, valor_dominio_id BIGINT NULL, CONSTRAINT PK_ENCARGO PRIMARY KEY (id))] 
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619) 

を持っており、私のエンティティEncargoは次のとおりです。

プライベート静的最終長いserialVersionUIDの= 1L;

@Id 
@GeneratedValue(strategy = GenerationType.IDENTITY) 
private Long id; 

@Column(name = "importe_total") 
private Double importeTotal; 

@Column(name = "fecha_encargo") 
private LocalDate fechaEncargo; 

@Column(name = "fecha_entrega") 
private LocalDate fechaEntrega; 

@Column(name = "detalle_vestido") 
private String detalleVestido; 

@ManyToOne 
private Cliente cliente; 

@ManyToOne 
private ValorDominio tipoEvento; 

@ManyToOne 
private ValorDominio estado; 

@OneToMany(mappedBy = "encargo") 
@JsonIgnore 
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 
private Set<Pago> pagos = new HashSet<>(); 

と私の変更履歴は次のとおりです。

<column name="valor_dominio_id" type="bigint" > 
    <constraints nullable="true" /> 
</column> 

<column name="valor_dominio_id" type="bigint"> 
    <constraints nullable="true" /> 
</column> 

属性は次のとおりです。

@ManyToOne 
private ValorDominio tipoEvento; 

@ManyToOne 
private ValorDominio estado; 

私はあなたの答えを待っています。

答えて

0

エラーは、1:nをマッピングする適切な方法は、多くの側に「entity_id」列を与えることです。あなたのJDLはValorDominoからEncargoへの一方向関係を指していますが、ValorDominoは所有側です。その結果、Encargoは参照するエンティティのビューを持たず、それを識別する方法がまだありません。これは、あなたが持っているエラーにつながります。

との関係を移動しよう:1つの定義:

relationshop ManyToOne { 
    Encargo{tipoEventoEncargo} to ValorDominio, 
    Encargo{estadoEncargo} to ValorDominio 
} 

ので、インクルードは勇気のドミノに列を結合するには、あなたの答えのための

0

おかげencargoに異なるだろう、イムあなたの方法をしようとしたが動作しません、

私はこれにしようと正常に動作しますが、今私はdiferent選択項目

ValorDominio{tipoEvento(descripcion)} to Encargo{tipoEcargo(descripcion)}, 
ValorDominio{estado(descripcion)} to Encargo{estado(descripcion)} 
01のdiferentデータを充電するためにビューにgetメソッドを変更する必要があります
関連する問題