由Eclipse中的Hibernate Tools生成的Pojo缺少@Entity,@ Id注释

时间:2015-07-11 23:13:23

标签: java hibernate

我需要在休眠配置中设置哪些设置才能将这些注释显示在自动生成的pojo中?

2 个答案:

答案 0 :(得分:0)

您需要创建一个简洁的hibernate配置文件:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
  <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:DSE</property>
  <property name="hibernate.connection.username">user</property>
  <property name="hibernate.connection.password">password</property>
  <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
  <property name="hibernate.default_schema">MYSCHEMA</property>
 </session-factory>
</hibernate-configuration>

请继续阅读this

答案 1 :(得分:0)

在Hibernate代码生成配置中 - &gt; Exporters选项卡,需要检查&#34;生成EJB3注释&#34;。