IntelliJ Java IDE
The moose likes Other Application Frameworks and the fly likes Unable to locate appropriate constructor on class... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Other Application Frameworks
Reply Bookmark "Unable to locate appropriate constructor on class..." Watch "Unable to locate appropriate constructor on class..." New topic
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...
 
Threads others viewed
Unable to locate appropriate constructor
JPA and static inner class, possible?
Fill java.awt.Choice from a List generated by a resultSet
How to instabntiate the class through EJB QL
How to replace space in URL String
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture