Hi all! I need advice, because I didn’t find a way to do it.
We want to implement a custom VersionType in which we are trying to override the Versiontype.next() method. Since we want to bind the version calculation logic to the hashcode of the entity object. There was a question. How can you access the computed object inside the VersionType?
public class HyperVersionType extends AbstractSingleColumnStandardBasicType<Short>
implements PrimitiveType<Short>, DiscriminatorType<Short>, VersionType<Short>
@Override
public Short next(Short current, SharedSessionContractImplementor session) {
return (short) (current + 1);
}
@NotNull
@Version
@Type(type = "org.hyperobjects.objcore.model.obj.HyperVersionType")
@Column(name = "version", nullable = false)
private short version;
Thanks in advance!