import.sql is a SQL script placed in src/main/resources to prepopulate a relational database when Quarkus connects through Hibernate with Panache. It preserves initial development data while repository-backed services replace generated in-memory stubs. section 7.2.2
Use import.sql with these operational constraints:
- Quarkus uses the script by default in development mode when the file exists. section 11.1.1
- Production mode disables SQL-script loading by default; explicitly set quarkus.hibernate-orm.sql-load-script=import.sql to enable it. section 11.1.1
- Treat the contents primarily as testing and development data unless production loading is deliberately configured. section 7.2.2
Prepopulate the car inventory
Create src/main/resources/import.sql with INSERT statements for the Car table, such as Mazda 6 with license plate ABC123 and Ford Mustang with license plate XYZ987.
Listing 7.16 Example import.sql file to prepopulate the database
INSERT INTO Car (licensePlateNumber, manufacturer, model)
VALUES ('ABC123', 'Mazda', '6');
INSERT INTO Car (licensePlateNumber, manufacturer, model)
VALUES ('XYZ987', 'Ford', 'Mustang');
Inspect the complete import.sql listing containing the two initial Car records. section 7.2.2
