saboya / gorm-logical-delete

Database-agnostic logical delete for Grails.
http://saboya.github.io/gorm-logical-delete
Apache License 2.0
1 stars 1 forks source link

where clause query returns logically deleted entities. #7

Open edwardotis opened 7 years ago

edwardotis commented 7 years ago

The following returns the logically deleted MyEntity rows.

@Transactional(readOnly = true) List<MyEntity> getLists(User user) { def query = MyEntity.where{user==user}; def entities = query.list{ order("name", "asc") } return entities }

I had to manually add deleted==false to make the query work.

@Transactional(readOnly = true) List<MyEntity> getLists(User user) { def query = MyEntity.where{user==user && deleted==false}; def entities = query.list{ order("name", "asc") } return entities }

grails 2.5.5 java 8 runtime "org.postgresql:postgresql:9.4.1207"

    compile ":gorm-logical-delete:1.1"
    runtime ":hibernate4:4.3.10"
    compile ":postgresql-extensions:4.6.1"
edwardotis commented 7 years ago

fyi, I don't see any unit tests of the where clause queries.

https://github.com/saboya/gorm-logical-delete/blob/master/test/unit/com/b2wdigital/grails/plugin/gormlogicaldelete/TestDomainSpec.groovy