Hmm..

so, that's should work:

```
@Repository
public interface SimpleRepository extends EntityRepository<Simple, Long>
{

    @Override
    @Query(hints = {@QueryHint(name = "javax.persistence.cache.storeMode",
value = BYPASS)})
    List<Simple> findAll();
}
```

On Thu, Jun 11, 2015 at 11:53 AM, akm <ameh...@ford.com> wrote:

> Thanks for the reply.
>
> We are creating a framework that all our enterprise applications will be
> using; so I am looking for a generic solution that I can add in a abstract
> class that then all entities can use.
> Basically looking for something like just adding a hint to the current
> AbstractEntityRepository's findAll.
> In the solution you mention all the applications would have to implement
> the
> findAll for all the entities.
>
> What I have currently is the below solution, but now the enterprise
> framework would have to implement this for all the find methods provided by
> the DeltaSpike repository which leads to maintenance issues and thus
> negates
> a lot of positives that DeltaSpike would provide us.
>
> *Current solution -*
> public abstract class MyBaseEntityCrudRepository<ENTITY, PK extends
> Serializable>
> extends AbstractEntityRepository<ENTITY, Serializable> implements
> Deactivatable {
>
>     public List<ENTITY> findAllFromDatabase() {
>
>         CriteriaQuery<ENTITY> query = this.criteriaQuery();
>         Root<ENTITY> root = query.from(entityClass());
>         query = query.select(root);
>         TypedQuery<ENTITY> typedQuery =
> this.entityManager().createQuery(query);
>         typedQuery.setHint("javax.persistence.cache.retrieveMode",
> CacheRetrieveMode.BYPASS);
>
>         return typedQuery.getResultList();
>
>     }
>
>
> *I am looking for something easier method to add like -*
>     /**
>      * @see org.apache.deltaspike.data.api.EntityRepository#findAll()
>      */
>     @Override
>     @QueryHint("javax.persistence.cache.storeMode",
> CacheRetrieveMode.BYPASS)
>     public List<ENTITY> findAll() {
>      return super.findAll();
>     }
>
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/DeltaSpike-Data-Module-Repository-tp4660831p4660840.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>



-- 
Best regard,
Daniel Cunha (soro)

Reply via email to