We need to add custom clause to all of selects and we have to do it 
automatically.

For example:

@Entity
  | public class A extends DeletableEntity{
  |     @OneToMany(mappedBy = "a")
  |     @Where(clause = "DELETED=0 or DELETED is null")
  |     private Set<B> bSet = new HashSet<B>();
  | 
  | ....
  | }
  | 
  | @Entity
  | public class B extends DeletableEntity
  | {
  |     @ManyToOne
  |     @Where(clause = "DELETED=0 or DELETED is null")
  |     private A a;
  | 
  | ....
  | }


when executed follow HQL with select from A:
"select b.DELETED from A a join a.bSet b"

generated SQL have needed clause
select bset1_.DELETED as col_0_0_ from A a0_ inner join B bset1_ on 
a0_.id=bset1_.a_id and ( bset1_.DELETED=0 or bset1_.DELETED is null)

But from this HQL:
"select b.DELETED from B b join b.a a"
query naven't any clause:
select b0_.DELETED as col_0_0_ from B b0_ inner join A a1_ on b0_.a_id=a1_.id 

How can we to select only not deleted A entities, jioned to B?

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4235116#4235116

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4235116
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to