JPA Data Model Specification¶
This document provides detailed information about the JPA entity classes in the com.perun.tlinq.client.nts.db.visa package. These entities are mapped to database tables in the nts schema and are used for managing visa-related operations.
For information on the physical database structure, check the physical data model
Table of Contents¶
- VisaapplicantEntity
- VisaapplicationEntity
- VisadeliveryEntity
- InvoiceEntity
- DocumentrequirementcacheEntity
VisaapplicantEntity¶
Represents an applicant for a visa in the system.
Table Mapping - visaapplicant¶
- Schema:
nts - Table:
visaapplicant - ID Generator: Sequence-based (
visaapplicant_seq)
Table structure of visaapplicant¶
| Field Name | Database Column | Type | Constraints | Description |
|---|---|---|---|---|
| id | visaapplicantid | Integer | Primary Key | Unique identifier for the visa applicant |
| visaapplicationid | visaapplicationid | Integer | Not Null | Reference to the visa application |
| applicantName | applicant_name | String(200) | Not Null | Full name of the applicant |
| dateOfBirth | date_of_birth | Date | Not Null | Date of birth of the applicant |
| passportNationality | passport_nationality | String(3) | Not Null | Three-letter country code of passport nationality |
| passportNumber | passport_number | String(50) | Not Null | Passport number |
| passportIssueDate | passport_issue_date | Date | Issue date of the passport | |
| passportExpiryDate | passport_expiry_date | Date | Expiry date of the passport | |
| travelCountry | travel_country | String(3) | Not Null | Three-letter country code of destination |
| passportImageS3Url | passport_image_s3_url | String | URL pointing to the passport image in S3 storage | |
| travelStartDate | travel_start_date | Date | Not Null | Start date of the travel |
| travelEndDate | travel_end_date | Date | Not Null | End date of the travel |
| createDate | create_date | Date | Default: CURRENT_TIMESTAMP | Record creation date |
| createUser | create_user | String(100) | Not Null | User who created the record |
| updateDate | update_date | Date | Default: CURRENT_TIMESTAMP | Last update date |
| updateUser | update_user | String(100) | Not Null | User who last updated the record |
Client Model Mapping of visaapplicant¶
Maps to CVisaApplicant with the following field mappings:
- id → applicantId
- visaapplicationid → applicationId
- applicantName → applicantName
- dateOfBirth → birthDate
- passportNationality → nationality
- travelCountry → travelDestination
- etc.
VisaapplicationEntity¶
Represents a visa application in the system.
Table Mapping - visaapplication¶
- Schema:
nts - Table:
visaapplication - ID Generator: Sequence-based (
visaapplication_seq)
Fields - visaapplication¶
| Field Name | Database Column | Type | Constraints | Description |
|---|---|---|---|---|
| id | visaapplicationid | Integer | Primary Key | Unique identifier for the visa application |
| customerid | customerid | Integer | Not Null | Customer ID reference |
| customerName | customer_name | String(255) | Not Null | Name of the customer |
| customerPhone | customer_phone | String(50) | Not Null | Phone number of the customer |
| customerEmail | customer_email | String(255) | Not Null | Email address of the customer |
| supplierid | supplierid | Integer | Supplier ID reference | |
| supplierApplicationDate | supplier_application_date | Date | Date when application was sent to supplier | |
| issuanceStatus | issuance_status | String(50) | Current status of visa issuance process | |
| paymentStatus | payment_status | String(50) | Current status of payment | |
| supplierCost | supplier_cost | BigDecimal(12,2) | Cost charged by the supplier | |
| customerPrice | customer_price | BigDecimal(12,2) | Price charged to the customer | |
| paymentOverride | payment_override | Boolean | Default: false | Flag to override payment requirements |
| createDate | create_date | Date | Default: CURRENT_TIMESTAMP | Record creation date |
| createUser | create_user | String(100) | Not Null | User who created the record |
| updateDate | update_date | Date | Default: CURRENT_TIMESTAMP | Last update date |
| updateUser | update_user | String(100) | Not Null | User who last updated the record |
Client Model Mapping - visaapplication¶
Maps to CVisaApplication with field mappings like:
- id → visaApplicationId
- customerid → customerId
- supplierid → supplierId
- etc.
VisadeliveryEntity¶
Manages the delivery of issued visas to applicants.
Table Mapping - visadelivery¶
- Schema:
nts - Table:
visadelivery - ID Generator: Sequence-based (
visadelivery_seq)
Fields - visadelivery¶
| Field Name | Database Column | Type | Constraints | Description |
|---|---|---|---|---|
| id | visadeliveryid | Integer | Primary Key | Unique identifier for the visa delivery |
| visaapplicationid | visaapplicationid | Integer | Not Null | Reference to the visa application |
| visaPdfS3Url | visa_pdf_s3_url | String | Not Null | URL pointing to the visa PDF in S3 storage |
| confirmationCode | confirmation_code | String(20) | Not Null | Code for confirming delivery receipt |
| codeGeneratedDate | code_generated_date | Date | Default: CURRENT_TIMESTAMP | Date when confirmation code was generated |
| codeExpiryDate | code_expiry_date | Date | Not Null | Expiration date for the confirmation code |
| emailSentDate | email_sent_date | Date | Date when email notification was sent | |
| smsSentDate | sms_sent_date | Date | Date when SMS notification was sent | |
| downloadDate | download_date | Date | Date when the visa was downloaded | |
| createDate | create_date | Date | Default: CURRENT_TIMESTAMP | Record creation date |
| createUser | create_user | String(100) | Not Null | User who created the record |
| updateDate | update_date | Date | Default: CURRENT_TIMESTAMP | Last update date |
| updateUser | update_user | String(100) | Not Null | User who last updated the record |
Client Model Mapping - visadelivery¶
Maps to CVisaDelivery with field mappings like:
- id → visaDeliveryId
- visaapplicationid → visaApplicationId
- visaPdfS3Url → pdfStorageUrl
- codeGeneratedDate → codeGenerationDate
- codeExpiryDate → codeExpirationDate
- etc.
InvoiceEntity¶
Manages invoices for visa applications.
Table Mapping - invoice¶
- Schema:
nts - Table:
invoice - ID Generator: Sequence-based (
invoice_seq)
Fields- invoice¶
| Field Name | Database Column | Type | Constraints | Description |
|---|---|---|---|---|
| id | invoiceid | Integer | Primary Key | Unique identifier for the invoice |
| visaapplicationid | visaapplicationid | Integer | Not Null | Reference to the visa application |
| invoiceDate | invoice_date | Date | Not Null | Date when the invoice was issued |
| invoicePdfS3Url | invoice_pdf_s3_url | String | Not Null | URL pointing to the invoice PDF in S3 storage |
| telrPaymentLink | telr_payment_link | String | Not Null | Payment link for Telr payment gateway |
| paymentStatus | payment_status | String(50) | Current status of payment | |
| paymentReceivedDate | payment_received_date | OffsetDateTime | Date when payment was received | |
| createDate | create_date | Date | Default: CURRENT_TIMESTAMP | Record creation date |
| createUser | create_user | String(100) | Not Null | User who created the record |
| updateDate | update_date | Date | Default: CURRENT_TIMESTAMP | Last update date |
| updateUser | update_user | String(100) | Not Null | User who last updated the record |
| invoiceNum | invoice_num | String(30) | Invoice number | |
| sourceId | source_id | Integer | Source system identifier |
Client Model Mapping - invoice¶
Maps to CVisaInvoice with field mappings like:
- id → invoiceId
- visaapplicationid → visaApplicationId
- invoiceNum → invoiceNumber
- invoicePdfS3Url → pdfStorageUrl
- telrPaymentLink → paymentLink
- etc.
DocumentrequirementcacheEntity¶
Caches visa document requirements for specific nationality-destination combinations.
Table Mapping - documentrequirementcache¶
- Schema:
nts - Table:
documentrequirementcache - ID Generator: Sequence-based (
documentrequirementcache_seq)
Fields - documentrequirementcache¶
| Field Name | Database Column | Type | Constraints | Description |
|---|---|---|---|---|
| id | documentrequirementcacheid | Integer | Primary Key | Unique identifier for the cache entry |
| passportNationality | passport_nationality | String(3) | Not Null | Three-letter country code of passport nationality |
| travelCountry | travel_country | String(3) | Not Null | Three-letter country code of destination |
| requirements | requirements | JSON (Map) | Not Null | JSON object containing visa requirements |
| lastFetched | last_fetched | Date | Default: CURRENT_TIMESTAMP | Date when requirements were last fetched |
| createDate | create_date | Date | Default: CURRENT_TIMESTAMP | Record creation date |
| createUser | create_user | String(100) | Not Null | User who created the record |
| updateDate | update_date | Date | Default: CURRENT_TIMESTAMP | Last update date |
| updateUser | update_user | String(100) | Not Null | User who last updated the record |
Client Model Mapping - documentrequirementcache¶
Maps to CVisaRequirement with field mappings like:
- id → visaRequirementId
- passportNationality → fromCountry
- travelCountry → toCountry
- requirements → requirements
- etc.
Common Patterns¶
All entities in this package:
- Extend the
NTSEntitybase class - Are mapped to tables in the
ntsschema - Use sequences for ID generation
- Include audit fields (createDate, createUser, updateDate, updateUser)
- Have corresponding client-side model classes prefixed with "C" (e.g., CVisaApplicant)
- Use Jakarta Persistence annotations for ORM mapping
- Implement validation constraints using Jakarta Validation