Hi Forum,
I'm trying to get this work.
I have one table, let's say: User, and Role. User to Role are many to many relation. But there's a flag on Role (deleteDate) to indicate it's been deleted. So, the join relation should have something like: where role.deletedate is NULL (0 in MySQL). Currently, I'm using: @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }) @JoinTable(name = "tbl_userrole", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id")) I need to find a way to add where condition in it. I think formula was for this purpose. But I don't know how can I do that. @Forumla annotation doesn't work in this case.
Any idea?
Thanks
Noodle
|