inverseJoinColumns = @JoinColumn(name = "reader_id") @WhereJoinTable( clause = "created_on > DATEADD( 'DAY', -7, CURRENT_TIMESTAMP() )") private List<Reader> currentWeekReaders = new ArrayList<>( );
@Entity(name = "Product") public static class Product { @Id @GeneratedValue private int id; @OneToMany(fetch = FetchType.EAGER) @JoinColumn private Set<Category> categoriesOneToMany = new HashSet<>(); @OneToMany(fetch = FetchType.EAGER) @JoinColumn @Where( clause = "description is not null" ) private Set<Category> categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesManyToMany") private Set<Category> categoriesManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) @Where( clause = "description is not null" ) private Set<Category> categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) @Where( clause = "description is not null" ) @WhereJoinTable( clause = "categoryId < 4") private Set<Category> categoriesWithDescIdLt4ManyToMany = new HashSet<>(); }
inverseJoinColumns = @JoinColumn(name = "ite_id") @WhereJoinTable(clause = "ite_id < 20") private List<IntNoAutoIdTestEntity> references1; inverseJoinColumns = @JoinColumn(name = "ite_id") @WhereJoinTable(clause = "ite_id >= 20") private List<IntNoAutoIdTestEntity> references2;
inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false, updatable = false) @WhereJoinTable(clause = "child2_id is not null") private List<ParentEntity> parents = new ArrayList<ParentEntity>();
inverseJoinColumns = @JoinColumn(name = "child1_id", insertable = false, updatable = false) @WhereJoinTable(clause = "child1_id is not null") private List<Child1Entity> children1 = new ArrayList<Child1Entity>(); inverseJoinColumns = @JoinColumn(name = "child2_id", insertable = false, updatable = false) @WhereJoinTable(clause = "child2_id is not null") private List<Child2Entity> children2 = new ArrayList<Child2Entity>();
inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false, updatable = false) @WhereJoinTable(clause = "child1_id is not null") private List<ParentEntity> parents = new ArrayList<ParentEntity>();
@ManyToMany(cascade = CascadeType.PERSIST) @OrderBy("expirationDate") @Where(clause = "1=1") @WhereJoinTable(clause = "2=2") @Filter(name="Groupfilter", condition = "3=3") @FilterJoinTable(name="Groupfilter", condition = "4=4") public Collection<Permission> getPermissions() { return permissions; }
@ManyToMany(cascade = CascadeType.PERSIST) @OrderBy("expirationDate") @Where(clause = "1=1") @WhereJoinTable(clause = "2=2") @Filter(name="Groupfilter", condition = "3=3") @FilterJoinTable(name="Groupfilter", condition = "4=4") public Set<Permission> getPermissions() { return permissions; }
@JoinColumn(name = "role_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "permission_id", referencedColumnName = "id") }) @WhereJoinTable(clause = NOT_DELETED) @Where(clause = NOT_DELETED) private List<Permission> permissions;
@WhereJoinTable(clause = NOT_DELETED) @ManyToMany(mappedBy = "permissions", cascade = CascadeType.DETACH) private List<Role> roles;
@WhereJoinTable(clause = NOT_DELETED) @ManyToMany(cascade = CascadeType.DETACH) @JoinTable(name = "role_user", joinColumns = {
@WhereJoinTable(clause = NOT_DELETED) @ManyToMany(mappedBy = "roles", cascade = CascadeType.DETACH) private List<User> users; @WhereJoinTable(clause = NOT_DELETED) @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "permission_role", joinColumns = {
@JoinColumn(name = "user_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "role_id", referencedColumnName = "id") }) @WhereJoinTable(clause = NOT_DELETED) @Where(clause = NOT_DELETED) private List<Role> roles;