• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to locate appropriate constructor on class...

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

this HQL is giving me error..
Caused by: Unable to locate appropriate constructor on class [Hibernate.CommonClasses.LibraryVO]

this is my query :- String query = "select new Hibernate.CommonClasses.LibraryVO(lib.libDocumentName,lib.libDocumentAddedDateTime,lib.libDocumentUploadedby,rat.libDocumentAdminRating,lib.libLocation,sta.libDocumentDownloadCount) from LibDocumentInfo as lib, LibDocumentStatus as sta, LibDocumentRating as rat where lib.libDocumentIndex=sta.libDocumentIndex and lib.libDocumentIndex=rat.libDocumentIndex and lib.libDocumentName like '" + val + "%'";
List temp= session.createQuery(query).list();

and this is my LibraryVO class construtor
public LibraryVO(String name,Date dat,String upload,String rating,String loc,int count) {
super();

libDocumentName=name;
libDocumentAddedDateTime=dat;
libDocumentUploadedby=upload;
libDocumentAdminRating=rating;
libLocation=loc;
libDocumentDownloadCount=count;

}

cam nybody tell me wats wrong in this???
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you need to follow the JavaBean convention in your business objects if you want to use hibernate with them. You need a no-arg constructor as well as public getters and setters for all the fields you want persisted.
 
Himanshu Rawat
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i have public constructor with no arg and with arg also. Watever attributes i m declaring in class i have corresponding getter and setter too..moreover i have used same thing in other applications tooo there it works...bt its givin me error in this case....why sooo??
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic