hibernate不保存对象

8ftvxx2r  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(315)

我正在尝试使用session保存对象。它到达daoimpl时也没有任何错误。但是在运行该部分之后,当查看数据库时,没有任何记录。

@Override
public Long saveRuleParameter(ElgRuleParameter elgRuleParameter,String tenantId) {
    return super.saveInTenant(elgRuleParameter,tenantId);

}

这是action类中的方法

private ElgRuleParameter ruleParameter = new ElgRuleParameter();
  ElgColumn elgColumn =   insertNewElgColumnForDynamicField(formFieldId, parameter, getTenantId());
                ruleParameter.setRuleParamName(parameter);
                logger.info("Saving the elg rule parameter  [{}], in tenant [{}]", parameter, getTenantId());
                ruleParameter.setElgColumn(elgColumn);
                FormField formField = formFieldService.findByIdInTenant(formFieldId, getTenantId());
                ruleParameter.setFormField(formField);
                ruleParameter.setParameterType(ScandiumKeyBox.DYNAMIC_FIELD);
                ruleParameterService.saveRuleParameter(ruleParameter,getTenantId());

这是模型课

package lk.gov.elg.orm.model.payment.configuration;

  import lk.gov.elg.orm.model.CustomInput;
  import lk.gov.elg.orm.model.dyanform.FormField;
  import lk.gov.elg.orm.model.payment.tax.LaRate;
  import lk.gov.elg.orm.model.workflow.ElgActivity;
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  import org.hibernate.annotations.*;

  import javax.persistence.*;
  import javax.persistence.Entity;
  import javax.persistence.Table;
  import java.io.Serializable;

  @Entity
  @FilterDef(name = "tenantFilter", parameters = @ParamDef(name =     "tenantIdParam", type = "string"))
  @Filters(@Filter(name = "tenantFilter", condition = "ad_rup_tenant_id = :tenantIdParam"))
  @Table(name = "ad_elg_rule_param")
  @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
  @JsonIgnoreProperties(ignoreUnknown = true)
  public class ElgRuleParameter implements Serializable {
  @Id
  @Column(name = "ad_rup_id")
  @GeneratedValue(strategy = GenerationType.AUTO)
private long id;
  @Column(name = "ad_rup_tenant_id", nullable = false, updatable = false)
private String tenantId;
@Column(name = "ad_rup_param_name")
private String ruleParamName;
@Column(name = "ad_rup_param_order")
private int paramOrder;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_rul_id")
@LazyCollection(LazyCollectionOption.FALSE)
private ElgRule elgRule;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_et_id")
@LazyCollection(LazyCollectionOption.FALSE)
private ElgColumn elgColumn;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_act_id")
@LazyCollection(LazyCollectionOption.FALSE)
private ElgActivity elgActivity = new ElgActivity();

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_custom_input_id")
@LazyCollection(LazyCollectionOption.FALSE)
private CustomInput customInput;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_charge_type")
@LazyCollection(LazyCollectionOption.FALSE)
private ChargeType chargeType;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_la_rate")
@LazyCollection(LazyCollectionOption.FALSE)
private LaRate laRate;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_charge_type_parameter")
@LazyCollection(LazyCollectionOption.FALSE)
private ChargeType chargeTypeParameter;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ad_form_field")
@LazyCollection(LazyCollectionOption.FALSE)
private FormField formField;

@Column(name = "ad_parameter_type")
private Integer parameterType;

@Column(name = "ad_parameter_code")
private String parameterCode;

public long getId() {
    return id;
}

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

public String getTenantId() {
    return tenantId;
}

public void setTenantId(String tenantId) {
    this.tenantId = tenantId;
}

public String getRuleParamName() {
    return ruleParamName;
}

public void setRuleParamName(String ruleParamName) {
    this.ruleParamName = ruleParamName;
}

public int getParamOrder() {
    return paramOrder;
}

public void setParamOrder(int paramOrder) {
    this.paramOrder = paramOrder;
}

public ElgRule getElgRule() {
    return elgRule;
}

public void setElgRule(ElgRule elgRule) {
    this.elgRule = elgRule;
}

public ElgColumn getElgColumn() {
    return elgColumn;
}

public void setElgColumn(ElgColumn elgColumn) {
    this.elgColumn = elgColumn;
}

public ElgActivity getElgActivity() {
    return elgActivity;
}

public void setElgActivity(ElgActivity elgActivity) {
    this.elgActivity = elgActivity;
}

public void setCustomInput(CustomInput customInput) {
    this.customInput = customInput;
}

public CustomInput getCustomInput() {
    return customInput;
}

public Integer getParameterType() {
    return parameterType;
}

public void setParameterType(Integer parameterType) {
    this.parameterType = parameterType;
}

public ChargeType getChargeType() {
    return chargeType;
}

public void setChargeType(ChargeType chargeType) {
    this.chargeType = chargeType;
}

public LaRate getLaRate() {
    return laRate;
}

public void setLaRate(LaRate laRate) {
    this.laRate = laRate;
}

public ChargeType getChargeTypeParameter() {
    return chargeTypeParameter;
}

public void setChargeTypeParameter(ChargeType chargeTypeParameter) {
    this.chargeTypeParameter = chargeTypeParameter;
}

public FormField getFormField() {
    return formField;
}

public void setFormField(FormField formField) {
    this.formField = formField;
}

public String getParameterCode() {
    return parameterCode;
}

public void setParameterCode(String parameterCode) {
    this.parameterCode = parameterCode;
}

}
我调试并查看了对象。对象也没有任何问题。在服务器记录器中也没有任何错误。因此任何人都可以给出解决方案。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题