0

I have 3 java classes, two entites and the third is relationship between them. I want to map them in hbm.xml, but I don't know how, I can't find any example on internet

public class Product {

private String _description;
private String _name;
private double _price;
private Long _productId;
private int _quantity;


public class Order {

private Long _orderId;
private List<OrderProduct> _productList;
private User _user;



public class OrderProduct {

private Order _order;
private Product _product;

How to map this in xml, to this thrid class "OrderProduct" stores only order and product as primary and foreign keys.

Thanks in advice

4

1 回答 1

0

不需要 OrderProduct 实体。您可以在 hbm 本身中定义映射。请参阅以下链接以了解其完成方式。

https://www.mkyong.com/hibernate/hibernate-many-to-many-relationship-example/

于 2017-04-21T06:35:30.857 回答