Skip to content

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

  1. VisaapplicantEntity
  2. VisaapplicationEntity
  3. VisadeliveryEntity
  4. InvoiceEntity
  5. 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: - idapplicantId - visaapplicationidapplicationId - applicantNameapplicantName - dateOfBirthbirthDate - passportNationalitynationality - travelCountrytravelDestination - 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: - idvisaApplicationId - customeridcustomerId - supplieridsupplierId - 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: - idvisaDeliveryId - visaapplicationidvisaApplicationId - visaPdfS3UrlpdfStorageUrl - codeGeneratedDatecodeGenerationDate - codeExpiryDatecodeExpirationDate - 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: - idinvoiceId - visaapplicationidvisaApplicationId - invoiceNuminvoiceNumber - invoicePdfS3UrlpdfStorageUrl - telrPaymentLinkpaymentLink - 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: - idvisaRequirementId - passportNationalityfromCountry - travelCountrytoCountry - requirementsrequirements - etc.


Common Patterns

All entities in this package:

  1. Extend the NTSEntity base class
  2. Are mapped to tables in the nts schema
  3. Use sequences for ID generation
  4. Include audit fields (createDate, createUser, updateDate, updateUser)
  5. Have corresponding client-side model classes prefixed with "C" (e.g., CVisaApplicant)
  6. Use Jakarta Persistence annotations for ORM mapping
  7. Implement validation constraints using Jakarta Validation