1、 Hibernate报错:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assigned before calling save();
解决:
hibernate出现这个错误的原因有可能因为,你的表中有个主键。 但是你插入的(调用save)时那个值是null你要操作的数据表中的id(即主键)的类型设置成了“自动增长类型”,而在你的hibernate.cfg.xml中,id的生成方式是assigned,把主键的生成方式改为native,它的特征是能够根据底层数据库自动选择主键生成方式 。2、nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern'
at character position 31
execution(*com.lzm.service.*.*(..))
^
execution(*com.lzm.service.*.*(..))
^
解决:pointcut表达式 第一个星号 和后面之间要有一个空格。如:execution(* com.lzm.service.*.*(..))。
本文主要介绍了两种常见的开发问题解决方案:一是Hibernate在尝试保存未分配主键的对象时引发的IdentifierGenerationException异常及其解决办法;二是配置AOP时由于切入点表达式书写不规范导致的IllegalArgumentException异常及正确写法。
2823

被折叠的 条评论
为什么被折叠?



