Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30597
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2014-12-19 07:13 -0800 |
| References | <be034564-30a4-4be6-82fa-2dc7717b70c9@googlegroups.com> <cfir38Fg52fU1@mid.individual.net> |
| Message-ID | <fb6aebf7-3cc3-4957-9283-3bd96cf0848a@googlegroups.com> (permalink) |
| Subject | Re: Class<T> get generic type at runtime CDI |
| From | Leonan Luppi <leonan.luppi@gmail.com> |
Em sexta-feira, 19 de dezembro de 2014 12h30min14s UTC-2, Robert Klemme escreveu:
> On 19.12.2014 13:23, Leonan Luppi wrote:
> > Hello,
> >
> > I'm try to get generic class type but isn't work. Someone can help
> > me? I'm using CDI Weld to Inject my DAO class with a generic type:
> >
> >
> > @Inject
> > private DAO<Agent> dao;
> >
> > And my DAO Class:
> >
> > public class DAO<T> {
> >
> > public T findAll() {
> > CriteriaQuery<T> query = em.getCriteriaBuilder()
> > .createQuery(HERE_MY_GENERIC_CLASS);
> > query.select(query.from(HERE_MY_GENERIC_CLASS));
> > return (T) em.createQuery(query).getResultList();
> > }
> >
> > }
> >
> >
> > How can i get at runtime? To make a query.
>
> Judging from the code you presented you need at least to return a
> collection of T (e.g. Iterable<T>) and not a T.
>
> Cheers
>
> robert
>
>
> --
> remember.guy do |as, often| as.you_can - without end
> http://blog.rubybestpractices.com/
Robert,
Sure i saw this after i've posted here. So How can I get my current T class in Runtime?
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Class<T> get generic type at runtime CDI Leonan Luppi <leonan.luppi@gmail.com> - 2014-12-19 04:23 -0800
Re: Class<T> get generic type at runtime CDI Robert Klemme <shortcutter@googlemail.com> - 2014-12-19 15:29 +0100
Re: Class<T> get generic type at runtime CDI Leonan Luppi <leonan.luppi@gmail.com> - 2014-12-19 07:13 -0800
Re: Class<T> get generic type at runtime CDI Sebastian <news@seyweiler.dyndns.org> - 2014-12-20 15:20 +0100
Re: Class<T> get generic type at runtime CDI Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-12-20 18:28 +0000
csiph-web