I was blocked on this so I created the following workaround.
I created a new custom type that is a subclass of the internal LongType class with a single override for the next method which just returns the existing version value. I then make the VERSION field use this custom type.
I will continue to watch this ticket in the hope that I can remove this hack at some point!
My annotation was :
@Version
@Generated(GenerationTime.ALWAYS)
@Column(name = "sequence")
private Long sequence;
public class LongVersionType extends LongType {
@Override
public Long next(Long current, SessionImplementor session) {
return current;
}
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
I was blocked on this so I created the following workaround.
I created a new custom type that is a subclass of the internal LongType class with a single override for the next method which just returns the existing version value. I then make the VERSION field use this custom type.
I will continue to watch this ticket in the hope that I can remove this hack at some point!
My annotation was :
@Version
@Generated(GenerationTime.ALWAYS)
@Column(name = "sequence")
private Long sequence;
And I changed it to :
@Version
@Generated(GenerationTime.ALWAYS)
@Type(type = "com.suberjus.hibernate.LongVersionType")
@Column(name = "sequence")
private Long sequence;
And added the following class :
package com.suberjus.hibernate;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.type.LongType;
public class LongVersionType extends LongType {
@Override
public Long next(Long current, SessionImplementor session) { return current; }
}