I am not able to see the values of the object in debug and it show InvocationException.
This is the code snippet by which I am trying to get the data from DB as previousObject by repository.getById(passing the Key from the mappedObject) which is mapped to the FundRequest Entity Class.
final FundRequest mappedObject = requestToEntityMapper.map(requests, entityClass.FundRequest);
final JpaRepository<U, Object> repository = repositoryStrategyProvider.getRepository(repoType);
Storable previousObject = null;
try {
----> previousObject = repository.getById(mappedObject.getKey()); <-----
}
catch (Exception e) {
System.out.println("error: " + e);
}
FundRequest Class is as below. Is it something to do with the Lombok & Hibernate annotations?
I am using @Data, @Entity. Now according to this article : Here I tried Removing @Data annotation and tried with @Getter @Setter, but still it throws the same exception
package com.abhishekpandey.jsonWriterReader.domain;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Entity;
import org.springframework.util.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name="FUND_REQUEST", schema="MYFUNDDB")
public class FundRequest implements Storable {
@Id
@Column(name = "DESC_CD")
private String descriptorCode;
@Column(name = "AREA_CD")
private String areaCode = "A";
@Column(name= "ACCT_CD")
private String accountingCode = StringUtils.EMPTY;
@Column(name = "FUND_CD")
private String fundCode = StringUtils.EMPTY;
@Column(name = "LOAD_STAT_C")
private Short loadStatusCode = 1;
@Column(name = "USER_I")
private String userId;
@Column(name = "MOD_TS")
public Timestamp lastUpdated;
@Column(name = "CREATION_TS")
public Timestamp createdAt;
@Override
public String getKey() {
return String.valueOf(descriptorCode);
}
}