Goog day, I'm using openjpa 1.0.3 (Unfortunately we use IBM WebSphere App
Server, their fix-packs comes out lately) and IBM DB2 9.5

I have a query:
StringBuilder sb = new StringBuilder();
sb.append("SELECT avg(timestampdiff(256, char(current timestamp -
p.birthdaydate))) as s5 FROM Person as p");
        
Query query = em.createNativeQuery(sb.toString(), InformerRow.class);
InformerRow ir = (InformerRow)query.getSingleResult();

And this is my class InformerRow:
public class InformerRow implements Serializable{
        private static final long serialVersionUID = 1L;
        
        public String s1;
        public long s2;
        public String s3;
        public long s4;
        public int s5;
        
        public InformerRow(){
                super();
        }
        
        public InformerRow(int s5){
                this.s5 = s5;
        }
        public InformerRow(Integer s5){
                this.s5 = s5;
        }

        public InformerRow(long s4, long s2){
                this.s4=s4;
                this.s2=s2;
        }
        
                public InformerRow(Long s4, Long s2){
                        this.s4=s4;
                        this.s2=s2;
                }

        public InformerRow(Number s2){
                this.s2 = s2.longValue();
        }
                
        public InformerRow(long s2){
                this.s2=s2;
        }
}

I've tried everything, to map avg(timestampdiff(256, char(current timestamp
- p.birthdaydate))) as long, as Number, as int nothing helps.
Unfortunately IBM WebSphere prints exceptions in Russian (absolutely crazy
idea to localize exceptions. Inventor of this "feature" is very-very ill),
so it prints something like:
"Exception raised during packing result in class InformerRow".

I see me query in trace.log, so it works fine, but JPA can't map result on
InformerRow field.
I don't know what to try?
Please, suggest me something.
-- 
View this message in context: 
http://n2.nabble.com/Can-t-map-AVG-sql-field-to-class-tp1562523p1562523.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to