hibernate中自动create出错
hibernate中自动create报错
运行ExportUtil自动创建序列和表时报错,信息如下:
Exception in thread "main" org.hibernate.MappingException: An association from the table t_street6 refers to an unmapped class: Districk
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1299)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1217)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:803)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at com.crm.util.ExportDB.main(ExportUtil.java:9)
原因:street类中<many-to-one name="districk" class="entity.Districk" column="districk_id"/>class那少写了entity包名
运行ExportUtil自动创建序列和表时报错,信息如下:
Exception in thread "main" org.hibernate.MappingException: An association from the table t_street6 refers to an unmapped class: Districk
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1299)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1217)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:803)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at com.crm.util.ExportDB.main(ExportUtil.java:9)
原因:street类中<many-to-one name="districk" class="entity.Districk" column="districk_id"/>class那少写了entity包名