DeltaSpike Data Module Repository

2015-06-11 Thread akm
We are piloting DeltaSpike Data Module in our enterprise.

Our requirements are to add a query hint to bypass cache for the find
methods since most of our applications need to get the latest data from the
database as the records may be directly inserted or updated in the database.
I cannot find a way to add hints to the repository find method. 
Is there a way to do this?

Thanks for the help.




--
View this message in context: 
http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/DeltaSpike-Data-Module-Repository-tp4660831.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at 
Nabble.com.


Re: DeltaSpike Data Module Repository

2015-06-11 Thread Daniel Cunha
Hi Akm,

Maybe, you can do something like:

```
public abstract class PersonRepository extends
AbstractEntityRepository
{

public Person findBySSN(String ssn)
{
return typedQuery("select p from Person p where p.ssn = ?1")
.setParameter(1, ssn)
.setHint("xpto","xpto-value")
.getResultList();
}

}
```

Or, you can use NamedQuery/NativeQuery.

We've this two solutions, ATM. (If I remember well, please DS guys, talk
more if I forget something)
If you have some another idea, please, share it and maybe we can discuss
and implement it or you can present a some solution with a patch/Pull
Request.


On Thu, Jun 11, 2015 at 10:37 AM, akm  wrote:

> We are piloting DeltaSpike Data Module in our enterprise.
>
> Our requirements are to add a query hint to bypass cache for the find
> methods since most of our applications need to get the latest data from the
> database as the records may be directly inserted or updated in the
> database.
> I cannot find a way to add hints to the repository find method.
> Is there a way to do this?
>
> Thanks for the help.
>
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/DeltaSpike-Data-Module-Repository-tp4660831.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>



-- 
Best regard,
Daniel Cunha (soro)


Re: DeltaSpike Data Module Repository

2015-06-11 Thread Daniel Cunha
Ops,

I wanted to say: NativeNamedQuery and the method should return a list, not
a entity.
I used a sample of the documentation and add the hint to show my example.
(I'm fixing it in documentation now)

On Thu, Jun 11, 2015 at 11:57 AM, Daniel Cunha  wrote:

> Hi Akm,
>
> Maybe, you can do something like:
>
> ```
> public abstract class PersonRepository extends
> AbstractEntityRepository
> {
>
> public Person findBySSN(String ssn)
> {
> return typedQuery("select p from Person p where p.ssn = ?1")
> .setParameter(1, ssn)
> .setHint("xpto","xpto-value")
> .getResultList();
> }
>
> }
> ```
>
> Or, you can use NamedQuery/NativeQuery.
>
> We've this two solutions, ATM. (If I remember well, please DS guys, talk
> more if I forget something)
> If you have some another idea, please, share it and maybe we can discuss
> and implement it or you can present a some solution with a patch/Pull
> Request.
>
>
> On Thu, Jun 11, 2015 at 10:37 AM, akm  wrote:
>
>> We are piloting DeltaSpike Data Module in our enterprise.
>>
>> Our requirements are to add a query hint to bypass cache for the find
>> methods since most of our applications need to get the latest data from
>> the
>> database as the records may be directly inserted or updated in the
>> database.
>> I cannot find a way to add hints to the repository find method.
>> Is there a way to do this?
>>
>> Thanks for the help.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/DeltaSpike-Data-Module-Repository-tp4660831.html
>> Sent from the Apache DeltaSpike Incubator Discussions mailing list
>> archive at Nabble.com.
>>
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>



-- 
Best regard,
Daniel Cunha (soro)


Re: DeltaSpike Data Module Repository

2015-06-11 Thread Daniel Cunha
you also can do:
http://deltaspike.apache.org/documentation/data.html#QueryOptions21

On Thu, Jun 11, 2015 at 12:02 PM, Daniel Cunha  wrote:

> Ops,
>
> I wanted to say: NativeNamedQuery and the method should return a list, not
> a entity.
> I used a sample of the documentation and add the hint to show my example.
> (I'm fixing it in documentation now)
>
> On Thu, Jun 11, 2015 at 11:57 AM, Daniel Cunha 
> wrote:
>
>> Hi Akm,
>>
>> Maybe, you can do something like:
>>
>> ```
>> public abstract class PersonRepository extends
>> AbstractEntityRepository
>> {
>>
>> public Person findBySSN(String ssn)
>> {
>> return typedQuery("select p from Person p where p.ssn = ?1")
>> .setParameter(1, ssn)
>> .setHint("xpto","xpto-value")
>> .getResultList();
>> }
>>
>> }
>> ```
>>
>> Or, you can use NamedQuery/NativeQuery.
>>
>> We've this two solutions, ATM. (If I remember well, please DS guys, talk
>> more if I forget something)
>> If you have some another idea, please, share it and maybe we can discuss
>> and implement it or you can present a some solution with a patch/Pull
>> Request.
>>
>>
>> On Thu, Jun 11, 2015 at 10:37 AM, akm  wrote:
>>
>>> We are piloting DeltaSpike Data Module in our enterprise.
>>>
>>> Our requirements are to add a query hint to bypass cache for the find
>>> methods since most of our applications need to get the latest data from
>>> the
>>> database as the records may be directly inserted or updated in the
>>> database.
>>> I cannot find a way to add hints to the repository find method.
>>> Is there a way to do this?
>>>
>>> Thanks for the help.
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/DeltaSpike-Data-Module-Repository-tp4660831.html
>>> Sent from the Apache DeltaSpike Incubator Discussions mailing list
>>> archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Best regard,
>> Daniel Cunha (soro)
>>
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>



-- 
Best regard,
Daniel Cunha (soro)


Re: DeltaSpike Data Module Repository

2015-06-11 Thread akm
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
extends AbstractEntityRepository implements
Deactivatable {

public List findAllFromDatabase() {

CriteriaQuery query = this.criteriaQuery();
Root root = query.from(entityClass());
query = query.select(root);
TypedQuery 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 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.


Re: DeltaSpike Data Module Repository

2015-06-11 Thread Daniel Cunha
Hmm..

so, that's should work:

```
@Repository
public interface SimpleRepository extends EntityRepository
{

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

On Thu, Jun 11, 2015 at 11:53 AM, akm  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 Serializable>
> extends AbstractEntityRepository implements
> Deactivatable {
>
> public List findAllFromDatabase() {
>
> CriteriaQuery query = this.criteriaQuery();
> Root root = query.from(entityClass());
> query = query.select(root);
> TypedQuery 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 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)


Re: DeltaSpike Data Module Repository

2015-06-11 Thread Thomas Hug
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  wrote:

> Hmm..
>
> so, that's should work:
>
> ```
> @Repository
> public interface SimpleRepository extends EntityRepository
> {
>
> @Override
> @Query(hints = {@QueryHint(name = "javax.persistence.cache.storeMode",
> value = BYPASS)})
> List findAll();
> }
> ```
>
> On Thu, Jun 11, 2015 at 11:53 AM, akm  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 > Serializable>
> > extends AbstractEntityRepository implements
> > Deactivatable {
> >
> > public List findAllFromDatabase() {
> >
> > CriteriaQuery query = this.criteriaQuery();
> > Root root = query.from(entityClass());
> > query = query.select(root);
> > TypedQuery 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 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)
>


Re: DeltaSpike Data Module Repository

2015-06-11 Thread Daniel Cunha
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  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 
> wrote:
>
> > Hmm..
> >
> > so, that's should work:
> >
> > ```
> > @Repository
> > public interface SimpleRepository extends EntityRepository
> > {
> >
> > @Override
> > @Query(hints = {@QueryHint(name =
> "javax.persistence.cache.storeMode",
> > value = BYPASS)})
> > List findAll();
> > }
> > ```
> >
> > On Thu, Jun 11, 2015 at 11:53 AM, akm  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 > > Serializable>
> > > extends AbstractEntityRepository implements
> > > Deactivatable {
> > >
> > > public List findAllFromDatabase() {
> > >
> > > CriteriaQuery query = this.criteriaQuery();
> > > Root root = query.from(entityClass());
> > > query = query.select(root);
> > > TypedQuery 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 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)


Re: DeltaSpike Data Module Repository

2015-06-12 Thread Thomas Hug
Thanks Daniel for checking! Different reason it doesn't work than I had in
memory :-)
I think we should go for a general solution and not just for
EntityRepository methods, @Query metadata should be considered for any
method expression. The place to change this is probably somewhere in
Delegate- and MethodQueryBuilder.

On Fri, Jun 12, 2015 at 4:19 AM, Daniel Cunha  wrote:

> 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  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 
> > wrote:
> >
> > > Hmm..
> > >
> > > so, that's should work:
> > >
> > > ```
> > > @Repository
> > > public interface SimpleRepository extends EntityRepository Long>
> > > {
> > >
> > > @Override
> > > @Query(hints = {@QueryHint(name =
> > "javax.persistence.cache.storeMode",
> > > value = BYPASS)})
> > > List findAll();
> > > }
> > > ```
> > >
> > > On Thu, Jun 11, 2015 at 11:53 AM, akm  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 > > > Serializable>
> > > > extends AbstractEntityRepository implements
> > > > Deactivatable {
> > > >
> > > > public List findAllFromDatabase() {
> > > >
> > > > CriteriaQuery query = this.criteriaQuery();
> > > > Root root = query.from(entityClass());
> > > > query = query.select(root);
> > > > TypedQuery 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 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)
>


Re: DeltaSpike Data Module Repository

2015-06-12 Thread Daniel Cunha
Thomas,

Sure!

MethodQueryBuilder already do it. [1]
I see for Delegate[2], but.. really, I don't know how to apply it here. :(

[1]
https://github.com/danielsoro/deltaspike/blob/applyRestrictions/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java#L48

[2]
https://github.com/danielsoro/deltaspike/blob/applyRestrictions/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java

On Fri, Jun 12, 2015 at 4:39 AM, Thomas Hug  wrote:

> Thanks Daniel for checking! Different reason it doesn't work than I had in
> memory :-)
> I think we should go for a general solution and not just for
> EntityRepository methods, @Query metadata should be considered for any
> method expression. The place to change this is probably somewhere in
> Delegate- and MethodQueryBuilder.
>
> On Fri, Jun 12, 2015 at 4:19 AM, Daniel Cunha 
> wrote:
>
> > 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 
> 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 
> > > wrote:
> > >
> > > > Hmm..
> > > >
> > > > so, that's should work:
> > > >
> > > > ```
> > > > @Repository
> > > > public interface SimpleRepository extends EntityRepository > Long>
> > > > {
> > > >
> > > > @Override
> > > > @Query(hints = {@QueryHint(name =
> > > "javax.persistence.cache.storeMode",
> > > > value = BYPASS)})
> > > > List findAll();
> > > > }
> > > > ```
> > > >
> > > > On Thu, Jun 11, 2015 at 11:53 AM, akm  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 > > > > Serializable>
> > > > > extends AbstractEntityRepository implements
> > > > > Deactivatable {
> > > > >
> > > > > public List findAllFromDatabase() {
> > > > >
> > > > > CriteriaQuery query = this.criteriaQuery();
> > > > > Root root = query.from(entityClass());
> > > > > query = query.select(root);
> > > > > TypedQuery 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 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)
> >
>



-- 
Best regard,
Daniel Cunha (soro)


Re: DeltaSpike Data Module Repository

2015-06-12 Thread Thomas Hug
gt; > > > *Current solution -*
> > > > > > public abstract class MyBaseEntityCrudRepository extends
> > > > > > Serializable>
> > > > > > extends AbstractEntityRepository implements
> > > > > > Deactivatable {
> > > > > >
> > > > > > public List findAllFromDatabase() {
> > > > > >
> > > > > > CriteriaQuery query = this.criteriaQuery();
> > > > > > Root root = query.from(entityClass());
> > > > > > query = query.select(root);
> > > > > > TypedQuery 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 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)
> > >
> >
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>


Re: DeltaSpike Data Module Repository

2015-06-12 Thread Daniel Cunha
gt; > > 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 > extends
> > > > > > > Serializable>
> > > > > > > extends AbstractEntityRepository
> implements
> > > > > > > Deactivatable {
> > > > > > >
> > > > > > > public List findAllFromDatabase() {
> > > > > > >
> > > > > > > CriteriaQuery query = this.criteriaQuery();
> > > > > > > Root root = query.from(entityClass());
> > > > > > > query = query.select(root);
> > > > > > > TypedQuery 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 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)
> > > >
> > >
> >
> >
> >
> > --
> > Best regard,
> > Daniel Cunha (soro)
> >
>



-- 
Best regard,
Daniel Cunha (soro)


Re: DeltaSpike Data Module Repository

2015-06-13 Thread Daniel Cunha
t; > 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> > extends
>> > > > > > > Serializable>
>> > > > > > > extends AbstractEntityRepository
>> implements
>> > > > > > > Deactivatable {
>> > > > > > >
>> > > > > > > public List findAllFromDatabase() {
>> > > > > > >
>> > > > > > > CriteriaQuery query = this.criteriaQuery();
>> > > > > > > Root root = query.from(entityClass());
>> > > > > > > query = query.select(root);
>> > > > > > > TypedQuery 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 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)
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > Best regard,
>> > Daniel Cunha (soro)
>> >
>>
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>



-- 
Best regard,
Daniel Cunha (soro)


Re: DeltaSpike Data Module Repository

2015-06-15 Thread Thomas Hug
> > public interface SimpleRepository extends
> >> EntityRepository >> > > > Long>
> >> > > > > > {
> >> > > > > >
> >> > > > > > @Override
> >> > > > > > @Query(hints = {@QueryHint(name =
> >> > > > > "javax.persistence.cache.storeMode",
> >> > > > > > value = BYPASS)})
> >> > > > > > List findAll();
> >> > > > > > }
> >> > > > > > ```
> >> > > > > >
> >> > > > > > On Thu, Jun 11, 2015 at 11:53 AM, akm 
> 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 >> > extends
> >> > > > > > > Serializable>
> >> > > > > > > extends AbstractEntityRepository
> >> implements
> >> > > > > > > Deactivatable {
> >> > > > > > >
> >> > > > > > > public List findAllFromDatabase() {
> >> > > > > > >
> >> > > > > > > CriteriaQuery query = this.criteriaQuery();
> >> > > > > > > Root root = query.from(entityClass());
> >> > > > > > > query = query.select(root);
> >> > > > > > > TypedQuery 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 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)
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Best regard,
> >> > Daniel Cunha (soro)
> >> >
> >>
> >
> >
> >
> > --
> > Best regard,
> > Daniel Cunha (soro)
> >
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>