Thomas,

you're right, not work.
I changed and works now[1], but I don't know if this is the better way to
fix it.

https://github.com/danielsoro/deltaspike/commit/bb02f14731e9c7fd5d20c255bae2a2033617a9b8

On Thu, Jun 11, 2015 at 4:11 PM, Thomas Hug <thomas....@gmail.com> wrote:

> Using the @Query(hints...) is the place to set the hints with DS Data.
> Unfortunately (hope my memory isn't wrong) this currently doesn't work with
> a method expression. As soon as there's a @Query it's not considered a
> method expression anymore.
>
> Should not be too difficult to change - and should be changed as the sample
> from Daniel makes totally sense :-) Will check this tomorrow and create a
> JIRA issue.
>
>
>
> On Thu, Jun 11, 2015 at 5:42 PM, Daniel Cunha <daniels...@gmail.com>
> wrote:
>
> > 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)
> >
>



-- 
Best regard,
Daniel Cunha (soro)

Reply via email to