| @Chris Cranford Thanks for your support. I gave a try to the Spring's latest build and it works solving this problem. I am just wondering if I've to open a new Hibernate improvement ticket because supplying my own Revision entity, Hibernate continue to create the hibernate_sequence table even if it doesn't use it. Just to be clear, this is my bean:
@Entity
@RevisionEntity(RevInfoListener.class)
public class RevInfo {
private String username;
private String remoteAddress;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@RevisionNumber
private int id;
@RevisionTimestamp
private long timestamp;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Transient
public Date getRevisionDate() {
return new Date(timestamp);
}
@Transient
public Instant getRevisionInstant() {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneOffset.systemDefault()).toInstant(ZoneOffset.UTC);
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getRemoteAddress() {
return remoteAddress;
}
public void setRemoteAddress(String remoteAddress) {
this.remoteAddress = remoteAddress;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DefaultRevisionEntity)) {
return false;
}
final RevInfo that = (RevInfo) o;
return id == that.id && timestamp == that.timestamp;
}
@Override
public int hashCode() {
int result;
result = id;
result = 31 * result + (int) (timestamp ^ (timestamp >>> 32));
return result;
}
@Override
public String toString() {
return "RevInfo(id = " + id + ", revisionDate = " + DateFormat.getDateTimeInstance().format(getRevisionDate()) + ")";
}
}
|