S2SH 着手项目所遇到的问题

1、查看客户时发生的错误

严重: Exception occurred during processing request: customer_info is not mapped [from customer_info]; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: customer_info is not mapped [from customer_info]
org.springframework.orm.hibernate5.HibernateQueryException: customer_info is not mapped [from customer_info]; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: customer_info is not mapped [from customer_info]


 CusDAOimpl中HQL语句里

public List<CusInfo_fy> findALL() {
        String querystr="from customer_info";
        List<CusInfo_fy> list = (List<CusInfo_fy>) this.getHibernateTemplate().find(querystr);
        return list;
    }
customer_info是我数据库中的表名,但是应该写 在javaweb中需要映射的实体类 CusInfo

 2、对于数据库设置日期是date 但页面显示dateTime,注意映射文件中type是“java.sql.Date”,而不是“java.util.Date”

3、在数据库中我有进行外键约束但是一直报错:Cannot delete or update a parent row: a foreign key constraint fails

  解决方法:取消数据库中表的外键约束,在Dao文件中进行判断是否数据表中存在,存在则在action返回false,并提示用户错误页面。

4、如何在一个action执行完跳转实现另一个action

  通过Struts文件中设置<result name="success" type="redirect">/orderList.action</result>

5、在hibernate配置文件中,如果多个action关联同一个service,注意保持<property name="cusService" ref="cusService"></property>的一致,否则容易报错

  最好在action页面中自动生成service 的setter,否则容易找不到service的关联

6、我是采用一个action对应一个action文件,但是显得很啰嗦,一开始忘记了可以在Struts配置文件直接定义action 中method属性来实现多个action在一个文件中。

 

posted on   石墨方  阅读(168)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示