Skip to content

GoGlobal Hotel Static Data Import

Purpose

The GoGlobal hotel import tool populates the local database cache (goglobal.country, goglobal.city, goglobal.hotel tables) from a GoGlobal hotel dataset CSV file. This cache is required for the hotel-by-name search and hotel-by-city lookup features, as GoGlobal's live API does not support name-based hotel discovery.

The import is a one-time or periodic bulk operation — run it whenever GoGlobal provides an updated hotel dataset.

Prerequisites

Requirement Details
Java 17+ Amazon Corretto 17 or compatible JDK
Deployed application tqapi.jar, lib/, and libext/ in the deployment directory
Database access PostgreSQL with the tlinq database accessible; goglobal schema must exist
GoGlobal CSV file Hotel dataset file obtained from GoGlobal (typically ~225,000 rows)

CSV File Format

The GoGlobal hotel dataset is a pipe-delimited CSV with quoted values and a UTF-8 BOM at the start of the file.

Header row:

"CountryId"|"Country"|"IsoCode"|"CityId"|"City"|"HotelID"|"Name"|"Address"|"Phone"|"Fax"|"Stars"|"StarsID"|"Longitude"|"Latitude"|"IsApartment"|"GiataCode"|"ExpediaXmlCode"|"HotelBedsXmlCode"|"BookingcomXmlCode"|"NtIncomingXmlCode"

Example data row:

"79"|"Germany"|"DE"|"605"|"ESSEN"|"648898"|"HOTEL-RESTAURANT SCHMACHTENBERGSHOF"|"Schmachtenbergstrasse 157"|"+49 201 471091"|""|"3"|"3"|"7.0839"|"51.4333"|"False"|""|""|""|""|""

Country and city data is denormalized (repeated across hotel rows). The tool deduplicates automatically.

Database Tables Populated

Table Primary Key Key Columns
goglobal.country countryid countryname, countrycode
goglobal.city cityid cityname, countryid, citycode
goglobal.hotel hotelid hotelname, address, cityid, category, starrating, longitude, latitude

The tool uses upsert (merge) — existing records are updated, new records are inserted. It is safe to run multiple times on the same or updated dataset.

Running the Import

./config/scripts/goglobal-hotel-import.sh /path/to/goglobal-hotels.csv

The script defaults TLINQ_HOME to the scripts/ directory (where config files are soft-linked), assembles the classpath from tqapi.jar + lib/*.jar + libext/*.jar (the standard deployed layout), and prints the target database before importing. Override TLINQ_HOME or JAVA_OPTS as needed:

JAVA_OPTS="-Xmx1g" ./config/scripts/goglobal-hotel-import.sh /data/hotels.csv

Option 2: Gradle Task (Development Only)

For local development environments where Gradle is available:

export TLINQ_HOME=/path/to/tqpro/config

./gradlew :tqgglbl:importHotels --args="/path/to/goglobal-hotels.csv"

Configuration

The tool reads database connection settings from the standard TQPro configuration chain:

  1. TLINQ_HOME environment variable must point to the config/ directory
  2. config/tourlinq-config.xml — resolves the database name (##tlinq.dbname) and connection details from the <Databases> section
  3. config/tourlinq.properties — provides the tlinq.dbname value (e.g., local, dev, prod)
  4. config/goglobal-client.xml — provides the GoGlobal-specific dbname property and optional dbpass override
  5. hibernate.cfg.xml (on classpath) — Hibernate/HikariCP connection pool settings

To target a specific database environment, set tlinq.dbname in tourlinq.properties before running:

# For local development
tlinq.dbname=local

# For dev server
tlinq.dbname=dev

# For production (use with caution)
tlinq.dbname=prod

Expected Output

Starting GoGlobal hotel data import from: /data/goglobal-hotels.csv
Pass 1: Reading CSV file...
  Read 5000 rows...
  Read 10000 rows...
  ...
  Read 225000 rows...
Pass 1 complete: 225431 rows read, 198 countries, 14562 cities, 225431 hotels
Pass 2: Inserting countries and cities...
  Countries: 198 merged
  Cities: 14562 merged
Pass 3: Inserting hotels...
  Processed 5000 hotels...
  Processed 10000 hotels...
  ...
  Processed 225000 hotels...

Import complete!
  Countries: 198
  Cities:    14562
  Hotels:    225431

Typical runtime: 2-5 minutes depending on database proximity and hardware.

Verification

After import, verify the data was loaded correctly:

-- Row counts
SELECT 'countries' AS entity, COUNT(*) FROM goglobal.country
UNION ALL
SELECT 'cities', COUNT(*) FROM goglobal.city
UNION ALL
SELECT 'hotels', COUNT(*) FROM goglobal.hotel;

-- Sample hotel search (what the application will do)
SELECT h.hotelid, h.hotelname, h.category, c.cityname, co.countrycode
FROM goglobal.hotel h
JOIN goglobal.city c ON h.cityid = c.cityid
JOIN goglobal.country co ON c.countryid = co.countryid
WHERE LOWER(h.hotelname) LIKE '%hilton%'
ORDER BY h.hotelname
LIMIT 10;

-- Verify a specific city has hotels
SELECT COUNT(*) FROM goglobal.hotel WHERE cityid = 605;  -- ESSEN

You can also verify via the application API:

curl -X POST http://localhost:11080/tlinq-api/hotel/searchByName \
  -H "Content-Type: application/json" \
  -d '{"session":"","keyword":"Hilton"}'

Troubleshooting

Problem Cause Solution
ExceptionInInitializerError on startup TLINQ_HOME not set or config files missing Verify TLINQ_HOME points to config/ directory containing tourlinq-config.xml and goglobal-client.xml
database name not configured dbname property missing in goglobal-client.xml Check goglobal-client.xml has <property name="dbname" value="##tlinq.dbname"/> and tourlinq.properties has tlinq.dbname=<env>
Connection refused / timeout Database not running or wrong environment Check tlinq.dbname value in tourlinq.properties matches a <Database> entry in tourlinq-config.xml; verify the database server is accessible
relation "goglobal.hotel" does not exist goglobal schema not created Run CREATE SCHEMA IF NOT EXISTS goglobal; and ensure Hibernate hbm2ddl.auto=update is enabled, or create tables manually from the JPA entity definitions
Skipping lines / low hotel count Malformed CSV rows Check the CSV uses pipe (\|) delimiters with double-quoted values. Review the console output for specific line numbers that were skipped
OutOfMemoryError Very large CSV with default JVM heap Add -Xmx1g to the Java command or set JAVA_OPTS before running the Gradle task

Scheduling Periodic Refreshes

If GoGlobal provides regular dataset updates (e.g., monthly), the import can be scheduled as a cron job:

# Monthly refresh on the 1st at 3:00 AM
0 3 1 * * /opt/tqpro/config/scripts/goglobal-hotel-import.sh /data/goglobal/latest-hotels.csv >> /var/log/tqpro/goglobal-import.log 2>&1
  • Hotel API SpecificationPOST /hotel/searchByName, POST /hotel/getByCity endpoints that query this cache
  • Hotel User Guide — "Importing Hotels from Online Suppliers" section for the frontend import workflow
  • Local Development — Development environment setup including database configuration