I am using hibernate JPA.
I have a BasePersonnel
class as super class that has a filter
:
@Entity
@Table(name = "APP_PERSONEL")
@Filters({
@Filter(name = "authorize",
condition = " 1 = 1 ")
})
public class BasePersonel extends BaseEntity<Integer> {
...
}
and it has a child class:
@Entity
@Table(name = "RTS_PERSONNEL")
@Filters({
@Filter(name = "authorize",
condition = " 2 = 2 ")
})
public class Personnel extends BasePersonel {
...
}
When I run query on Personnel
class using hql, both filters(ie super class's filter and child class's filter) append to where
clause.
But I want just child class filter append to where
clause.
Is there any solution to override super class filter?
You can use a @Subselect
when mapping the entity.
@Entity
@Subselect("select * from APP_PERSONEL where authorize = 1")
public class BasePersonel extends BaseEntity<Integer> {
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With