-
1. Re: Projection
bill.burke Mar 1, 2006 12:02 PM (in response to martinganserer)A List of Object[] is returned. Also, take a look at the constructor expressions. you could do this:
public class ArticleSummary { public int id; public String articleNo; public ArticleSummary(int id, String article) {...} ... } createQuery("select new com.acme.ArticleSummary(a.id, a.articleNo) From Article a");
You would get back a list of ArticleSummary objects. EJB QL allocates ArticleSummary calling the constructor with the column parameters you queried. -
2. Re: Projection
martinganserer Mar 2, 2006 2:38 AM (in response to martinganserer)Hi Bill,
thank you for your response!
At the moment I am reading a book about Hibernate. In one chapter the book describes projection (in Hibernate) very well. In one example I have seen that Hibernate was able to get a result list without a "hard defined" object like ArticleSummary.
What I want to get is a list containing properties only, as I want to build a generic reporting tool. Generic in this case means that one session bean can create different result lists for different queries. The whole EJB-QL should be created automatically and should return only a data list (like a simple table) with a fixed number of columns and a specific number of rows.
This isn't possible in EJB3, is it?