0 Replies Latest reply on Feb 25, 2007 8:50 AM by chrismalan

    Cannot find a suitable constructor

    chrismalan

      I have a custom util class called LessonView. It looks like this:

      public class LessonView{
      private String subject;
      private int year, count;
      
      public LessonView(){}
      
      public LessonView(String subject, int year, int count){
       sets the variables via setters
      }
      
      public getters and setters
      }


      Then I have a query:
      "select new LessonView(l.subject, l.year, count(*)) from Lesson l group by l.lesson, l.year order by l.lesson, l.year";


      This throws exceptions telling me there is no suitable constructor. When the count(*) is removed everything works fine. I have used custom classes before with sum(whatever.k) and it worked fine. I have also tried count(l.id), same results.

      Any idea how to fix this? The database is MySQL.

      Thanks,