| /* |
| * Copyright (c) 2018, 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: |
| // Oracle - initial API and implementation from Oracle TopLink |
| package org.eclipse.persistence.jpa.collection.model; |
| |
| import jakarta.persistence.Basic; |
| import jakarta.persistence.Column; |
| import jakarta.persistence.Embeddable; |
| import jakarta.persistence.JoinColumn; |
| import jakarta.persistence.ManyToOne; |
| |
| @Embeddable |
| public class Param { |
| |
| @Basic(optional = false) |
| @Column(name = "NAME", nullable = false) |
| public String name; |
| |
| @ManyToOne(optional = false) |
| @JoinColumn(name = "LEVEL_ID", nullable = false) |
| public Level level; |
| |
| @Override |
| public int hashCode() { |
| final int prime = 31; |
| int result = 1; |
| result = prime * result + ((level == null) ? 0 : level.hashCode()); |
| result = prime * result + ((name == null) ? 0 : name.hashCode()); |
| return result; |
| } |
| |
| @Override |
| public boolean equals(Object obj) { |
| if (this == obj) { |
| return true; |
| } |
| if (obj == null) { |
| return false; |
| } |
| if (getClass() != obj.getClass()) { |
| return false; |
| } |
| Param other = (Param) obj; |
| if (level == null) { |
| if (other.level != null) { |
| return false; |
| } |
| } else if (!level.equals(other.level)) { |
| return false; |
| } |
| if (name == null) { |
| if (other.name != null) { |
| return false; |
| } |
| } else if (!name.equals(other.name)) { |
| return false; |
| } |
| return true; |
| } |
| } |