生成Hibernate映射文件时未创建注释

RMa*_*gen 2 java hibernate jboss-tools hibernate-tools

我正在跟踪此链接以生成休眠文件

https://www.mkyong.com/hibernate/how-to-generate-code-with-hibernate-tools/

文件已生成但没有注释。我检查了“ generate EJB3注解”,但仍然无法正常工作,数据库是Postgres。我曾经用相同的方法做过,而且运行良好。.几周前,我升级到日食并改变了工作场所,因为那时它不工作..有谁知道该活动是否有日志文件?也许我可以在那找到一些东西?

这是我的hibernate.cfg.xml文件

    <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
    <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
    <property name="hibernate.connection.password">password</property>
    <property name="hibernate.connection.url">jdbc:postgresql://xxxxx/yyy</property>
    <property name="hibernate.connection.username">user</property>
    <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    <!-- <property name="hibernate.enable_lazy_load_no_trans">false</property> -->
    <property name="hibernate.search.autoregister_listeners">true</property>
    <property name="hibernate.validator.apply_to_ddl">false</property>
    <property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>
    <property name="hibernate.enable_lazy_load_no_trans">true</property>


</session-factory>
Run Code Online (Sandbox Code Playgroud)

RMa*_*gen 10

在上面花了两天之后,我发现了问题..我的休眠版本是5.3,并且仍然在将休眠版本更改为5.2(在休眠配置窗口中)后,它起作用了!

  • 为什么在5.3和5.4版本的Hibernate中不起作用? (3认同)
  • @bodtx你不需要这样做,请参阅问题中如何使用eclipse生成实体,然后在配置窗口中有一个下拉菜单,你可以在其中更改hibernate版本 (2认同)