In my Spring/JPA/Hibernate/Envers PostgreSQL application I'm trying to implement Spring Data Auditing
I have a following entity:
@Audited
@AuditTable("levels_history")
@Entity
@Table(name = "levels")
public class Level extends BaseEntity implements Serializable {
private static final long serialVersionUID = 642499791438799548L;
@Id
@SequenceGenerator(name = "levels_id_seq", sequenceName = "levels_id_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "levels_id_seq")
private Long id;
private String name;
@NotAudited
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "level")
private List<Card> card = new ArrayList<Card>();
@CreatedBy
@Column(name = "created_by_user_id")
private User createdByUser;
@LastModifiedBy
@Column(name = "last_modified_by_user_id")
private User lastModifiedByUser;
where I have added:
@CreatedBy
@Column(name = "created_by_user_id")
private User createdByUser;
@LastModifiedBy
@Column(name = "last_modified_by_user_id")
private User lastModifiedByUser;
at the database level I want to write INTEGER
ID for created_by_user_id
and last_modified_by_user_id
but during execution my application throws an error that created_by_user_id
should be bytea
type.
What am I doping wrong and how to configure Spring Data Auditing to use INTEGER
for this purpose ?