I'm getting the following exception on a .save()
call in my Spring boot Application. I'm running Spring boot 2.2.5.RELEASE
Stack trace was too big to be included here so I've shared it at this link.
Here's the code:
Search search = new Search();
// ......Build Search Object here
searchRepository.save(search);
public interface searchRepository
extends BaseJpaRepository<Search, Long>, JpaSpecificationExecutor<Search> {
}
@Data
@Entity
@Table(name = "search")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Search extends AbstractAuditingEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
@Column(name = "externalId")
private Long externalId;
@NotNull
@Column(name = "search_term")
private String searchTerm;
@NotNull
@Column(name = "filters")
private String filters;
@NotNull
@Column(name = "results")
private Long results;
@Override
public int hashCode() {
return id != null ? id.hashCode() : IntegerUtils.ANSWER_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING;
}
}
I have ensured through debug mode on my IDE that all @NotNull
fields do not contain Null. I have also added the following missing values in application.yml :
jpa:
hibernate:
naming:
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
Have looked at multiple other answers on stackoverflow, but none have anything regarding this error. I recently upgraded my spring boot and this error has been showing up since then. Moreover I am able to read/write to spring session table, so I am assuming that this is not a configuration issue?
What am I doing wrong?