On Jan 13, 2008, at 4:32 PM, Andrus Adamchik wrote:
3. What I haven't done yet is applying this to the new List<Object[]> results, as the backend is not fully ready yet, and I need a better understanding of all consequences myself.

I tried to analyze this remaining case tonight (for the background you may check @SqlResultSetMapping annotation per Chapter 8.3.3 of the JPA spec)... SQLSelect (a would-be selecting parameterized SQLTemplate analog) is still a bit verbose...

SQLSelect<Integer> q1 = new SQLSelect<Integer>("DataMap1", Integer.class)
        .append("SELECT COUNT(1) FROM X");

SQLSelect<Object[]> q2 = new SQLSelect<Object[]>("DataMap1", Object[].class)
        .append("SELECT COUNT(1), SUM(PRICE), 'CONST_STRING' FROM X");

Of course <Object[]> doesn't tell us what's in the array... For the reference, here is a SQLSelect prototype:

public class SQLSelect<T> implements TypedQuery<T> {

        public SQLSelect(String dataMapName, Class<T> resultClass) {

        }

        public SQLSelect<T> append(String sql) {
                
        }
        
        public SQLSelect<T> append(String key, String sql) {
                
        }

        // more stuff goes here ...
}

Andrus

Reply via email to