| Author |
Unable to locate appropriate constructor on class...
|
Himanshu Rawat
Ranch Hand
Joined: Nov 27, 2005
Posts: 137
|
|
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???
|
rawat
SCJP 1.4
|
 |
Emanuel Kadziela
Ranch Hand
Joined: Mar 24, 2005
Posts: 93
|
|
|
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
Joined: Nov 27, 2005
Posts: 137
|
|
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??
|
 |
 |
|
|
subject: Unable to locate appropriate constructor on class...
|
|
|