简化多模型存储库springboot

问题描述

我根本不知道该怎么称呼我。 目前:我通过POST方法收到“ CheckConfigDeploymentObject”对象。处理完该对象后,我将其转换为该对象,以便能够将其插入“ CheckConfigDeploymentObjectInsertion”数据库中。 插入后,如果需要阅读,则必须使用另一个“ CheckConfigDeploiementLecture”对象。

出什么问题了?我发现它太复杂了,创建了太多模型,我认为我做的根本不是我应该做的。 (我是Java的新手。) 一切正常,我对此没有问题,但问题是如何做到这一点。如果可能的话,我正在等待答案(通过编辑文件)。

我的文件: CheckConfigDeploymentObject:

$1$2$4

CheckConfigDeploymentObjectInsertion:

package com....getterclasses.checkconfig;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;

@Entity
public class CheckConfigDeploiementObject {
    @Id
    @GeneratedValue
    
  @NotEmpty(message = "Namespace ne peut être vide")
  @Column(nullable = false) 
  private String namespace;
    
  @NotEmpty(message = "Composant ne peut être vide")
  @Column(nullable = false) 
  private String composant;
  
  @NotEmpty(message = "TypeVerification ne peut être vide")  
  @Column(nullable = false) 
  private String typeverification;
  
  @NotEmpty(message = "Status ne peut être vide")  
  @Column(nullable = false) 
  private String status;
  
  @NotEmpty(message = "Details ne peut être vide")
  @Column(nullable = true)  
  private String details; 
  
  @NotEmpty(message = "ReportDate ne peut être vide")
  @Column(nullable = false) 
  private String reportdate;

public String getNamespace() {
    return namespace;
}

public void setNamespace(String namespace) {
    this.namespace = namespace;
}

public String getComposant() {
    return composant;
}

public void setComposant(String composant) {
    this.composant = composant;
}

public String getTypeverification() {
    return typeverification;
}

public void setTypeverification(String typeverification) {
    this.typeverification = typeverification;
}

public String getStatus() {
    return status;
}

public void setStatus(String status) {
    this.status = status;
}

public String getDetails() {
    return details;
}

public void setDetails(String details) {
    this.details = details;
}

public String getReportdate() {
    return reportdate;
}

public void setReportdate(String reportdate) {
    this.reportdate = reportdate;
}

}

CheckConfigDeploiementLecture:

package com....getterclasses.checkconfig;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Entity
@Table(name = "checkconfigdeploiement")
public class CheckConfigDeploiementObjectInsertion {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Integer id;
  
  @NotNull(message = "IdNamespace ne peut être vide")
  @Column(name="idnamespace",nullable = false)  
  private Integer idnamespace;
  
  @NotNull(message = "IdServiceNamespace ne peut être vide")
  @Column(name="idservicenamespace",nullable = false)
  private Integer idservicenamespace;
  
  @NotEmpty(message = "Typeverification ne peut être NUL")
  @Column(name="typeverification",nullable = false)
  private String typeverification;
  
  @NotEmpty(message = "Status ne peut être vide")
  @Column(name="status",nullable = false)
  private String status;
  
  private String details;  
  
  
  @NotEmpty(message = "ReportDate ne peut être vide")
  @Column(name="reportdate",nullable = false)
  private String reportdate;


public Integer getId() {
    return id;
}


public void setId(Integer id) {
    this.id = id;
}


public Integer getIdnamespace() {
    return idnamespace;
}


public void setIdnamespace(Integer idnamespace) {
    this.idnamespace = idnamespace;
}


public Integer getIdservicenamespace() {
    return idservicenamespace;
}


public void setIdservicenamespace(Integer idservicenamespace) {
    this.idservicenamespace = idservicenamespace;
}


public String getTypeverification() {
    return typeverification;
}


public void setTypeverification(String typeverification) {
    this.typeverification = typeverification;
}


public String getStatus() {
    return status;
}


public void setStatus(String status) {
    this.status = status;
}


public String getDetails() {
    return details;
}


public void setDetails(String details) {
    this.details = details;
}


public String getReportdate() {
    return reportdate;
}


public void setReportdate(String reportdate) {
    this.reportdate = reportdate;
}
  
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)