且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

线程"main"中的异常java.lang.IllegalArgumentException:java.lang.Object不是索引实体或索引实体的子类

更新时间:2023-02-18 20:55:15

错误消息是错误的,应该是"java.lang.Object不是索引实体或索引的超类实体".我创建了票证,我们将尽快修复错误消息.

The error message is wrong, it should be "java.lang.Object is not an indexed entity or a superclass of an indexed entity". I created a ticket, we'll fix the error message ASAP.

关于您的问题,此异常意味着 Object 或其任何子类均未索引.简而言之,没有任何索引类.

Regarding your problem, this exception means neither Object nor any of its subclasses is indexed. In short, there isn't any indexed class.

我可以看到您的 Product 类已用 @Indexed 进行注释,因此这可能意味着您如何在 HibernateUtil .

I can see that your Product class is annotated with @Indexed, so this probably means there is a problem with how you start Hibernate ORM in HibernateUtil.

您在 displayContactTableData()中注释了 session = HibernateUtil.getSession(); 这一行的简单事实使我觉得您已经知道了.

The simple fact that you commented your line session = HibernateUtil.getSession(); in displayContactTableData() makes me think you already knew that, though.

您应该看一下入门指南确保您正确启动Hibernate ORM.

You should have a look at the getting started guide to make sure you start Hibernate ORM correctly.