Relative Content

Tag Archive for javahibernate

“Soft delete” in Hibernate with OneToOne mapping

I’m using a pattern called “soft delete”. Instesd of deleting entity I just mark it as deleted and prevent it from showing up in results of any query by adding @Where(clause = "rmv = false")(rmv is name of colum ind database where I store the flag).

Retrying after database error causes Hibernate exception

Under highly concurrent circumstances, the application trigger unique constraints while saving new data. So we have retry mechanism to fetch the data from DB again and if the data already present we will not save again.
But in the retry logic while trying to fetch data from postgresDB we are getting the following error:

What is the Alternative for this in hibernate 6.5.0

@Column(name = “CONTENT_TYPE”) @Type(type = “com.sp.ia.util.SPEnumType”, parameters = { @Parameter(name = “enum”, value = “com.sp.ia.modal.ContentType”)}) private ContentType contentType; Im getting The annotation @Type must define the attribute value and The attribute type is undefined for the annotation type Type.. Can Anyone help me to replace this in hibernate 6.5.0.. Thank you I want this to […]