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

Amit
  • 30,756
  • 6
  • 57
  • 88
tehnodrom
  • 75
  • 11

1 Answers1

0

There is no need for OrderProduct entity. You can define the mapping in the hbm Itself. Please see the below link to understand how its done.

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

OTM
  • 656
  • 5
  • 8