先創建一個PhotoInfo.hbm.xml 文件用hbm2java生成的java文件如下package finder;import java.io.Serializable;import java.util.List;import java.sql.SQLException;import net.sf.hibernate.*;import net.sf.hibernate.type.Type;/** Automatically generated Finder class for PhotoInfoFinder.* @author Hibernate FinderGenerator **/public class PhotoInfoFinder implements Serializable {...........................public static List findAll(Session session) throws SQLException, HibernateException {List finds = session.find("from PhotoInfo in class photo.PhotoInfo");return finds;}}注意上面的那個java文件 里面有個public static List findAll(Session session) 方法. 該方法的內容是錯誤的, 但是它是hbm2java自動生成的hql語言.. 那么我還是想用hbm2java這個工具的. 自動生成的hql語句為:from PhotoInfo in class photo.PhotoInfo正確的hql語句為:from photo.PhotoInfo
請問怎么樣做才能使findAll方法中的hql語句正確呢????
慕碼人8056858
2023-03-03 14:10:17