| /* |
| * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0, |
| * or the Eclipse Distribution License v. 1.0 which is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| */ |
| |
| // Contributors: |
| // 06/19/2019 - Will Dazey |
| // - 391279: Add support for Unidirectional OneToMany mappings with non-nullable values |
| package org.eclipse.persistence.jpa.test.mapping.model; |
| |
| import java.util.List; |
| |
| import jakarta.persistence.CascadeType; |
| import jakarta.persistence.Entity; |
| import jakarta.persistence.GeneratedValue; |
| import jakarta.persistence.GenerationType; |
| import jakarta.persistence.Id; |
| import jakarta.persistence.JoinColumn; |
| import jakarta.persistence.OneToMany; |
| |
| @Entity |
| public class PostC { |
| |
| @Id @GeneratedValue(strategy = GenerationType.AUTO) |
| private Long id; |
| |
| @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) |
| @JoinColumn(name = "COMPLEXID_C_A", referencedColumnName = "id", nullable = false) |
| private List<CommentC> comments; |
| |
| public PostC() { } |
| |
| public PostC(Long id) { |
| this.id = id; |
| } |
| |
| public List<CommentC> getComments() { |
| return comments; |
| } |
| |
| public void setComments(List<CommentC> comments) { |
| this.comments = comments; |
| } |
| } |