-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from catenax-ng/fix/gate_identifiers_not_retr…
…ivied fix(gate): fixed the persistence of LegalEntityIdentifier
- Loading branch information
Showing
5 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntityIdentifier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
******************************************************************************/ | ||
|
||
package org.eclipse.tractusx.bpdm.gate.entity | ||
|
||
import jakarta.persistence.* | ||
import org.eclipse.tractusx.bpdm.common.model.BaseEntity | ||
|
||
@Entity | ||
@Table( | ||
name = "legal_entity_identifiers", | ||
indexes = [ | ||
Index(columnList = "legal_entity_id") | ||
] | ||
) | ||
class LegalEntityIdentifier( | ||
@Column(name = "`value`", nullable = false) | ||
var value: String, | ||
|
||
@Column(name = "type_id", nullable = false) | ||
var type: String, | ||
|
||
@Column(name = "issuing_body") | ||
var issuingBody: String?, | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "legal_entity_id", nullable = false) | ||
var legalEntity: LegalEntity | ||
|
||
) : BaseEntity() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...-gate/src/main/resources/db/migration/V4_0_0_7__create_table_legal_entity_identifiers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CREATE TABLE legal_entity_identifiers ( | ||
id int8 NOT NULL, | ||
uuid uuid NOT NULL, | ||
created_at timestamp with time zone not null, | ||
updated_at timestamp with time zone not null, | ||
value varchar(255) NOT NULL, | ||
type_id varchar(255) NOT NULL, | ||
legal_entity_id int8 NOT NULL, | ||
issuing_body varchar(255) NULL, | ||
CONSTRAINT pk_identifiers PRIMARY KEY (id), | ||
CONSTRAINT uc_identifiers_uuid UNIQUE (uuid) | ||
); | ||
CREATE INDEX idx_9de08b456309ac30a77546592 ON legal_entity_identifiers USING btree (legal_entity_id); | ||
|
||
ALTER TABLE legal_entity_identifiers ADD CONSTRAINT fk_identifiers_on_partner FOREIGN KEY (legal_entity_id) REFERENCES legal_entities(id); |