【问题标题】:I would like to get hibernate exception我想获得休眠异常
【发布时间】:2018-10-18 23:53:18
【问题描述】:

如何在休眠中生成此异常

org.hibernate.MappingException stating that the Property maxindex does not exist in the collection 

【问题讨论】:

  • 你想得到这个例外???严重地?嗯,这条消息告诉你出了什么问题,所以,我想就这样做那个
  • @KevinAnderson 我是认真的
  • 我们很清楚:您不是在问“请向我解释一下我是如何得到这个异常的,我以后如何避免得到它?” .但是您正在特别问:“我如何故意导致此异常发生?”

标签: java hibernate orm hql


【解决方案1】:

我知道您想知道您是如何生成异常的,而不仅仅是生成它。信息很清楚,但是,你能显示你的映射吗?您可以指示 Hibernate 创建缺少的属性,将 hibernate.hbm2ddl.auto 属性值设置为“更新”:

<property name="hibernate.hbm2ddl.auto">update</property>

希望对你有帮助

【讨论】:

  • 听起来它可以通过使用 maxindex() 函数生成,我们将它用于像 Hashmap 或数组这样索引的集合...
猜你喜欢
  • 1970-01-01
  • 2011-02-14
  • 2014-08-22
  • 2011-09-20
  • 2017-07-06
  • 2012-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多