You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Rafael Pestano <rm...@gmail.com> on 2016/07/18 14:28:38 UTC

CriteriaSupport Injection

Hi guys,

For sake of simplicity, I'd like to use the following construct:

@Inject
CriteriaSupport<Entity> entityCriteria;


Is it possible? does it make sense for you?

We already do that (generic query execution) with EntityManager itself but
there is no criteria support.

thanks in advance.



-- 
Att,

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano

Re: CriteriaSupport Injection

Posted by Rafael Pestano <rm...@gmail.com>.
Yea, I was migrating an old "utility" class to use deltaspike criteria and
just deleted it in favor of DS criteria ;)


2016-07-19 8:36 GMT-03:00 John D. Ament <jo...@apache.org>:

> I was actually just about to respond with "not sure it makes sense".
>
> The reason being, we rely on an entity manager resolver in data to
> determine which EM the repository is associated with. You would have no way
> to differentiate criteria supports per EM as a result.
>
> Plus its always better to put your DB logic in your DB tier.
>
> John
>
> On Tue, Jul 19, 2016 at 7:10 AM Rafael Pestano <rm...@gmail.com>
> wrote:
>
> > Answering myself, Its possible (by extending CriteriaSupportHandler) but
> > not worth, better stick with  inheritance with current api(which is
> great).
> >
> > Em seg, 18 de jul de 2016 11:28, Rafael Pestano <rm...@gmail.com>
> > escreveu:
> >
> > > Hi guys,
> > >
> > > For sake of simplicity, I'd like to use the following construct:
> > >
> > > @Inject
> > > CriteriaSupport<Entity> entityCriteria;
> > >
> > >
> > > Is it possible? does it make sense for you?
> > >
> > > We already do that (generic query execution) with EntityManager itself
> > but
> > > there is no criteria support.
> > >
> > > thanks in advance.
> > >
> > >
> > >
> > > --
> > > Att,
> > >
> > > Rafael M. Pestano
> > >
> > > Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> > > http://rpestano.wordpress.com/
> > > @realpestano
> > >
> >
>



-- 
Att,

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano

Re: CriteriaSupport Injection

Posted by "John D. Ament" <jo...@apache.org>.
I was actually just about to respond with "not sure it makes sense".

The reason being, we rely on an entity manager resolver in data to
determine which EM the repository is associated with. You would have no way
to differentiate criteria supports per EM as a result.

Plus its always better to put your DB logic in your DB tier.

John

On Tue, Jul 19, 2016 at 7:10 AM Rafael Pestano <rm...@gmail.com> wrote:

> Answering myself, Its possible (by extending CriteriaSupportHandler) but
> not worth, better stick with  inheritance with current api(which is great).
>
> Em seg, 18 de jul de 2016 11:28, Rafael Pestano <rm...@gmail.com>
> escreveu:
>
> > Hi guys,
> >
> > For sake of simplicity, I'd like to use the following construct:
> >
> > @Inject
> > CriteriaSupport<Entity> entityCriteria;
> >
> >
> > Is it possible? does it make sense for you?
> >
> > We already do that (generic query execution) with EntityManager itself
> but
> > there is no criteria support.
> >
> > thanks in advance.
> >
> >
> >
> > --
> > Att,
> >
> > Rafael M. Pestano
> >
> > Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> > http://rpestano.wordpress.com/
> > @realpestano
> >
>

Re: CriteriaSupport Injection

Posted by Rafael Pestano <rm...@gmail.com>.
Answering myself, Its possible (by extending CriteriaSupportHandler) but
not worth, better stick with  inheritance with current api(which is great).

Em seg, 18 de jul de 2016 11:28, Rafael Pestano <rm...@gmail.com>
escreveu:

> Hi guys,
>
> For sake of simplicity, I'd like to use the following construct:
>
> @Inject
> CriteriaSupport<Entity> entityCriteria;
>
>
> Is it possible? does it make sense for you?
>
> We already do that (generic query execution) with EntityManager itself but
> there is no criteria support.
>
> thanks in advance.
>
>
>
> --
> Att,
>
> Rafael M. Pestano
>
> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> http://rpestano.wordpress.com/
> @realpestano
>