无法解析映射文件

时间:2019-07-15 09:33:44

标签: java hibernate

映射文件中有一些我找不到的问题。它给出了NullPointerException

试图更改标签。问题仍然存在。映射文件在下面。

<hibernate-mapping>
<class name = "model.Order" table = "USER_ORDER">

<id name = "orderId" type = "int" column = "ID" not-null = "true">
<generator class = "native"/>
</id>

<property name = "quantity" type = "int" column = "QUANTITY"/>
<property name = "cost" type = "int" column = "COST"/>
<property name = "status" type = "boolean" column = "STATUS"/>
<property name = "createdDate" type = "string" column = "CREATED"/>
<property name = "modifiedDate" type = "string" column = "MODIFIED"/>

<many-to-one name = "user" class = "model.User" column = "USER_ID"   
cascade = "save-update"  not-null = "true"/>
<set name = "orderDetail" cascade = "save-update" inverse = "false">
<key column = "ORDER_ID" not-null = "true"/>
<one-to-many class = "model.OrderDetails"/>
</set>

</class>
</hibernate-mapping>
  

数据库连接创建失败:无法解析映射
      文件:/mapping/Order.hbm.xml(资源)       线程“主”中的异常java.lang.NullPointerException         在db.DatabaseConnectionH.getSession(DatabaseConnectionH.java:39)         在dao.CartDao.getCarts(CartDao.java:72)         在services.CartServices.getUserCarts(CartServices.java:55)         在controller.CartController.checkCarts(CartController.java:214)         在MainMenu.main(MainMenu.java:87)

0 个答案:

没有答案