Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30594

Class<T> get generic type at runtime CDI

Newsgroups comp.lang.java.programmer
Date 2014-12-19 04:23 -0800
Message-ID <be034564-30a4-4be6-82fa-2dc7717b70c9@googlegroups.com> (permalink)
Subject Class<T> get generic type at runtime CDI
From Leonan Luppi <leonan.luppi@gmail.com>

Show all headers | View raw


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.

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


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