Я получаю эту ошибку. Я пытаюсь установить критерии поиска, эти критерии поиска работают с другими модулями, над которыми я работаю, но в этом конкретном модуле c я не уверен, почему я сталкиваюсь с этой ошибкой
(through reference chain: org.springframework.data.domain.PageImpl[\"content\"]->
java.util.Collections$UnmodifiableRandomAccessList[0]->
com.meteor.coral.portfolio.modules.client.domain.Client[\"membershipTypeId\"]->
com.meteor.coral.portfolio.common.infrastructure.codes.domain.CodeValue_$$_jvstb7f_65[\"handler\"])"
Это мой класс Entity (я только что удалил несколько длинных методов кодов). Я видел некоторые решения, в которых они помещают @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
, но я не знаю, где именно я должен его поместить. Помогите мне с этим спасибо
Это мой клиент. java class
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.meteor.coral.portfolio.common.infrastructure.codes.data.CodeValueData;
import com.meteor.coral.portfolio.common.infrastructure.codes.domain.CodeValue;
import com.meteor.coral.portfolio.common.infrastructure.core.api.JsonCommand;
import com.meteor.coral.portfolio.common.infrastructure.core.data.ApiParameterError;
import com.meteor.coral.portfolio.common.infrastructure.core.data.DataValidatorBuilder;
import com.meteor.coral.portfolio.common.infrastructure.core.domain.AbstractPersistableCustom;
import com.meteor.coral.portfolio.common.infrastructure.core.exception.PlatformApiDataValidationException;
import com.meteor.coral.portfolio.common.infrastructure.core.service.DateUtils;
import com.meteor.coral.portfolio.common.infrastructure.documentmanagement.domain.Image;
import com.meteor.coral.portfolio.common.infrastructure.security.service.RandomPasswordGenerator;
import com.meteor.coral.portfolio.common.organization.agentreferror.domain.AgentReferror;
import com.meteor.coral.portfolio.common.organization.membershipsubtyperegular.domain.MembershipSubTypeRegular;
import com.meteor.coral.portfolio.common.organization.office.domain.Office;
import com.meteor.coral.portfolio.common.organization.rankandserviceclass.domain.RankAndServiceClass;
import com.meteor.coral.portfolio.common.organization.relationshipandreverse.domain.RelationshipAndReverse;
import com.meteor.coral.portfolio.common.organization.staff.domain.Staff;
import com.meteor.coral.portfolio.common.organization.unitcode.domain.UnitCode;
import com.meteor.coral.portfolio.common.useradministration.domain.AppUser;
import com.meteor.coral.portfolio.modules.client.constants.ClientApiConstants;
import com.meteor.coral.portfolio.modules.group.domain.Group;
import com.meteor.coral.portfolio.modules.paymenttype.domain.PaymentType;
import lombok.Data;
@Entity
@Data
@Table(name = "m_client", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "account_no_UNIQUE"), //
@UniqueConstraint(columnNames = { "mobile_no" }, name = "mobile_no_UNIQUE") })
//@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
public final class Client extends BaseCoralModel {
//added by Rob
@Column(name = "memberno", length = 20, nullable = true)
private String memberno;
@Column(name = "account_no", length = 20, unique = true, nullable = false)
private String accountNumber;
@ManyToOne
@JoinColumn(name = "office_id", nullable = false)
private Office office;
@ManyToOne
@JoinColumn(name = "transfer_to_office_id", nullable = true)
private Office transferToOffice;
@OneToOne(optional = true)
@JoinColumn(name = "image_id", nullable = true)
private Image image;
/**
* A value from {@link ClientStatus}.
*/
@Column(name = "status_enum", nullable = false)
private Integer status;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "sub_status", nullable = true)
private CodeValue subStatus;
@Column(name = "activation_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date activationDate;
@Column(name = "office_joining_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date officeJoiningDate;
@Column(name = "firstname", length = 50, nullable = true)
private String firstname;
@Column(name = "middlename", length = 50, nullable = true)
private String middlename;
@Column(name = "lastname", length = 50, nullable = true)
private String lastname;
@Column(name = "fullname", length = 100, nullable = true)
private String fullname;
@Column(name = "display_name", length = 100, nullable = false)
private String displayName;
@Column(name = "mobile_no", length = 50, nullable = true, unique = true)
private String mobileNo;
@Column(name = "email_address", length = 50, unique = true)
private String emailAddress;
@Column(name = "is_staff", nullable = false)
private boolean isStaff;
@Column(name = "external_id", length = 100, nullable = true, unique = true)
private String externalId;
@Column(name = "date_of_birth", nullable = true)
@Temporal(TemporalType.DATE)
private Date dateOfBirth;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "gender_cv_id", nullable = true)
private CodeValue gender;
@ManyToOne
@JoinColumn(name = "staff_id")
private Staff staff;
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(name = "m_group_client", joinColumns = @JoinColumn(name = "client_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
private Set<Group> groups;
@Transient
private boolean accountNumberRequiresAutoGeneration = false;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "closure_reason_cv_id", nullable = true)
private CodeValue closureReason;
@Column(name = "closedon_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date closureDate;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reject_reason_cv_id", nullable = true)
private CodeValue rejectionReason;
@Column(name = "rejectedon_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date rejectionDate;
@ManyToOne(optional = true, fetch=FetchType.LAZY)
@JoinColumn(name = "rejectedon_userid", nullable = true)
private AppUser rejectedBy;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "withdraw_reason_cv_id", nullable = true)
private CodeValue withdrawalReason;
@Column(name = "withdrawn_on_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date withdrawalDate;
@ManyToOne(optional = true, fetch=FetchType.LAZY)
@JoinColumn(name = "withdraw_on_userid", nullable = true)
private AppUser withdrawnBy;
@Column(name = "reactivated_on_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date reactivateDate;
@ManyToOne(optional = true, fetch=FetchType.LAZY)
@JoinColumn(name = "reactivated_on_userid", nullable = true)
private AppUser reactivatedBy;
@ManyToOne(optional = true, fetch=FetchType.LAZY)
@JoinColumn(name = "closedon_userid", nullable = true)
private AppUser closedBy;
@Column(name = "submittedon_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date submittedOnDate;
// @ManyToOne(optional = true, fetch=FetchType.LAZY)
// @JoinColumn(name = "submittedon_userid", nullable = true)
// private AppUser submittedBy;
@Column(name = "updated_on", nullable = true)
@Temporal(TemporalType.DATE)
private Date updatedOnDate;
@ManyToOne(optional = true, fetch=FetchType.LAZY)
@JoinColumn(name = "updated_by", nullable = true)
private AppUser updatedBy;
@ManyToOne(optional = true, fetch=FetchType.LAZY)
@JoinColumn(name = "activatedon_userid", nullable = true)
private AppUser activatedBy;
@Column(name = "default_savings_product", nullable = true)
private Long savingsProductId;
@Column(name = "default_savings_account", nullable = true)
private Long savingsAccountId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "client_type_cv_id", nullable = true)
private CodeValue clientType;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "client_classification_cv_id", nullable = true)
private CodeValue clientClassification;
@Column(name = "legal_form_enum", nullable = true)
private Integer legalForm;
@Column(name = "reopened_on_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date reopenedDate;
@ManyToOne(optional = true, fetch = FetchType.LAZY)
@JoinColumn(name = "reopened_by_userid", nullable = true)
private AppUser reopenedBy;
@Column(name = "proposed_transfer_date", nullable = true)
@Temporal(TemporalType.DATE)
private Date proposedTransferDate;
//***additional fields for membership
//***
//***
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "membership_type_id", nullable = false)
private CodeValue membershipTypeId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "source_place_code_id", nullable = false)
private CodeValue sourcePlaceCodeId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "rank_and_service", nullable = false)
private RankAndServiceClass rankAndService;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_status_Id", nullable = false)
private CodeValue memberStatusId;
private String qualifier;
private boolean isChaplain;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "membership_sub_type_id", nullable = false)
private MembershipSubTypeRegular membershipSubTypeId;
private String overrideReason;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "override_by")
private AppUser overrideBy;
private String mothersMaidenName;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "family_group_identifier_id", nullable = false)
private CodeValue familyGroupIdentifierId;
private String badgeNo;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "unit_code", nullable = true)
private UnitCode unitCode;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "employer_id", nullable = true)
private CodeValue employerId;
private String natureOfWork;
private String tin;
@Temporal(TemporalType.DATE)
private Date regularizationDate;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "employment_status_id", nullable = false)
private CodeValue employmentStatusId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "employment_industry_id", nullable = false)
private CodeValue employmentIndustryId;
private String employmentName;
private String employmentPhoneNo;
private String riskRating;
private boolean pep;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "nationality_id", nullable = false)
private CodeValue nationalityId;
private boolean muslim;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "civil_status_id", nullable = false)
private CodeValue civilStatusId;
private String placeOfBirth;
private String phoneNo;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "payment_type_id", nullable = false)
private PaymentType paymentTypeId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "filing_mode_id", nullable = false)
private CodeValue filingMode;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "agent_referror_code_id", nullable = true)
private AgentReferror agentReferrorCodeId;
private boolean psslaiTosri;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "sources_of_funds_wealth_id", nullable = false)
private CodeValue sourcesOfFundsWealthId;
private String memberpan;
private String memberpin;
private String bosEmployeeNo;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "relationship_id", nullable = true)
private RelationshipAndReverse relationshipId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "principal_member")
private Client principalMember;
private boolean mentallyIncapacitated;
}
Это мой CodeValue. java class
@Entity
@Table(name = "m_code_value", uniqueConstraints = { @UniqueConstraint(columnNames = { "code_id", "code_value" }, name = "code_value_duplicate") })
public class CodeValue extends AbstractPersistableCustom<Long> {
private static final long serialVersionUID = 5671149962262010193L;
@Column(name = "code_value", length = 100)
private String label;
@Column(name = "order_position")
private int position;
@Column(name = "code_description")
private String description;
@ManyToOne
@JoinColumn(name = "code_id", nullable = false)
private Code code;
@Column(name = "is_active")
private boolean isActive;
@Column(name = "is_mandatory")
private boolean mandatory;
public static CodeValue createNew(final Code code, final String label, final int position, final String description,
final boolean isActive, final boolean mandatory) {
return new CodeValue(code, label, position, description, isActive, mandatory);
}
protected CodeValue() {
//
}
private CodeValue(final Code code, final String label, final int position, final String description,
final boolean isActive, final boolean mandatory) {
this.code = code;
this.label = StringUtils.defaultIfEmpty(label, null);
this.position = position;
this.description = description;
this.isActive = isActive;
this.mandatory = mandatory;
}
public String label() {
return this.label;
}
public int position() {
return this.position;
}
public static CodeValue fromJson(final Code code, final JsonCommand command) {
final String label = command.stringValueOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue());
Integer position = command.integerValueSansLocaleOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue());
String description = command.stringValueOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue());
Boolean isActiveObj = command.booleanObjectValueOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue());
boolean isActive = true;
if (isActiveObj != null) {
isActive = isActiveObj;
}
if (position == null) {
position = new Integer(0);
}
Boolean mandatory = command.booleanPrimitiveValueOfParameterNamed(
CODEVALUE_JSON_INPUT_PARAMS.IS_MANDATORY.getValue());
// if the "mandatory" Boolean object is null, then set it to false by default
if (mandatory == null) {
mandatory = false;
}
return new CodeValue(code, label, position.intValue(), description, isActive, mandatory);
}
public Map<String, Object> update(final JsonCommand command) {
final Map<String, Object> actualChanges = new LinkedHashMap<>(2);
final String labelParamName = CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue();
if (command.isChangeInStringParameterNamed(labelParamName, this.label)) {
final String newValue = command.stringValueOfParameterNamed(labelParamName);
actualChanges.put(labelParamName, newValue);
this.label = StringUtils.defaultIfEmpty(newValue, null);
}
final String decriptionParamName = CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue();
if (command.isChangeInStringParameterNamed(decriptionParamName, this.description)) {
final String newValue = command.stringValueOfParameterNamed(decriptionParamName);
actualChanges.put(decriptionParamName, newValue);
this.description = StringUtils.defaultIfEmpty(newValue, null);
}
final String positionParamName = CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue();
if (command.isChangeInIntegerSansLocaleParameterNamed(positionParamName, this.position)) {
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(positionParamName);
actualChanges.put(positionParamName, newValue);
this.position = newValue.intValue();
}
final String isActiveParamName = CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue();
if (command.isChangeInBooleanParameterNamed(isActiveParamName, this.isActive)) {
final Boolean newValue = command.booleanPrimitiveValueOfParameterNamed(isActiveParamName);
actualChanges.put(isActiveParamName, newValue);
this.isActive = newValue.booleanValue();
}
return actualChanges;
}
public CodeValueData toData() {
return CodeValueData.instance(getId(), this.label, this.position, this.isActive, this.mandatory);
}
}
Это то, что я получаю, когда нажимаю кнопку Вот что я получаю, когда нажимаю кнопку