Ce contenu n'est pas disponible dans la langue sélectionnée.
6.3. Hibernate Entities
The following is a snapshot of the hibernate function's entities:
@Entity @Table(name="orders") public class Order { @Id private Integer ordernumber; @Basic private String customerId; @OneToMany(mappedBy = "order", cascade = CascadeType.ALL) private List orderItems = new ArrayList(); public void addOrderLine(OrderLine orderLine) { orderItems.add(orderLine); } // Getters and Setters.... } @Entity @Table(name="orderlines") public class OrderLine { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; @ManyToOne @JoinColumn(name="orderid") private Order order; @Basic private Integer quantity; @ManyToOne @JoinColumn(name="productid") private Product product; // Getters and Setters.... } @Entity @Table(name = "products") @NamedQuery(name="product.byId", query="from Product p where p.id = :id") public class Product { @Id private Integer id; @Basic private String name; // Getters and Setters.... }