我正在尝试使用会话保存对象。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;
}
}
我调试并查看了对象。对象也没有任何问题。在服务器记录器中也没有任何错误,因此任何人都可以为此提供解决方案。