darrachequesne / spring-data-jpa-datatables

Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
Apache License 2.0
440 stars 174 forks source link

Ignore Hibernate @Where annotation #130

Open Aksigera opened 2 years ago

Aksigera commented 2 years ago

Hello,

I didn't find a way of how to ignore the Hibernate's @Where annotation on Entity.

The common approach to do so is to use nativeQuery, see stackoverflow.com/a/51250675/7968539.

But I'm not sure how to apply it to DataTables.

Is there a way to do so?

This is an entity with Hibernate's @Where annotation:

@Entity
@SQLDelete(sql = "UPDATE vehicle SET deleted_at = NOW() WHERE id = ?")
@Where(clause = "deleted_at IS NULL")
public class Vehicle extends AbstractEntity implements Serializable {...}

And this is a corresponding repository extending DataTablesRepository:

@Repository
public interface VehicleDataTableRepository extends DataTablesRepository<Vehicle, Long> {
}

Again, I need to see all Vehicles in my DataTable, disregarding the deleted_at column.

Thanks!