Hibernate手动导出数据表时候,有些字段没有在数据库表中生成!
Book类:privateStringid;privateStringname;privatedoubleprice;privateStringauthor;privat...
Book类:
private String id;
private String name;
private double price;
private String author;
private Category category; 为另一个POJO类
Book.hbm.xml:
<hibernate-mapping package="com.test.bean">
<class name="Book" table="Book">
<id name="id">
<column name="id" />
<generator class="uuid" />
</id>
<property name="name">
<column name="name" length="100" not-null="true" />
</property>
<property name="price">
<column name="name" not-null="true" />
</property>
<property name="author" >
<column name="author" length="20" />
</property>
<many-to-one name="category" class="com.test.bean.Category"
lazy="false">
<column name="categoryId" />
</many-to-one>
</class>
</hibernate-mapping>
只生成id、name、author、categoryId 没有生成price字段,
SchemaExport 导出 展开
private String id;
private String name;
private double price;
private String author;
private Category category; 为另一个POJO类
Book.hbm.xml:
<hibernate-mapping package="com.test.bean">
<class name="Book" table="Book">
<id name="id">
<column name="id" />
<generator class="uuid" />
</id>
<property name="name">
<column name="name" length="100" not-null="true" />
</property>
<property name="price">
<column name="name" not-null="true" />
</property>
<property name="author" >
<column name="author" length="20" />
</property>
<many-to-one name="category" class="com.test.bean.Category"
lazy="false">
<column name="categoryId" />
</many-to-one>
</class>
</hibernate-mapping>
只生成id、name、author、categoryId 没有生成price字段,
SchemaExport 导出 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询