在我的Spring / JPA / Hibernate / Envers PostgreSQL应用程序中,我试图实现Spring Data Auditing
我有一个以下实体:
@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;
我添加了:
@CreatedBy
@Column(name = "created_by_user_id")
private User createdByUser;
@LastModifiedBy
@Column(name = "last_modified_by_user_id")
private User lastModifiedByUser;
在数据库级别我想为INTEGER
和created_by_user_id
编写last_modified_by_user_id
ID,但在执行期间,我的应用程序会抛出created_by_user_id
应为bytea
的错误类型。
我做错了什么以及如何配置Spring Data Auditing以便为此目的使用INTEGER
?