Hi, I am trying to use cdbimport with the attached toy SQLite database. The pom.xml file and the log file are also attached.
My tables are imported but Cayenne 4.2.RC1 does not recognize any of the foreign key constraints. In other words: I can import the tables but their relationships are lost. I am following the steps in the Cayenne Guide: 3. DB-First Flow https://cayenne.apache.org/docs/4.2/cayenne-guide/#db-first-flow and also the Cayenne Database First tutorial: 2. Importing database https://cayenne.apache.org/docs/4.2/getting-started-db-first/#importing-database What am I doing wrong? Why are my foreign key constraints lost? If – for some reason – SQLite is not yet supported, would it work with Apache Derby Embedded DB? Any help is greatly appreciated. Best wishes, Ali
[INFO] Scanning for projects... [INFO] [INFO] -------------------------< mygroup:autoimport >------------------------- [INFO] Building autoimport 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- cayenne-maven-plugin:4.2.RC1:cdbimport (default-cli) @ autoimport --- [INFO] Connecting to 'jdbc:sqlite:/tmp/kundeninteressen.sqlite3' as 'null' [INFO] +++ Connecting: SUCCESS. [INFO] Connecting to 'jdbc:sqlite:/tmp/kundeninteressen.sqlite3' as 'null' [INFO] +++ Connecting: SUCCESS. [INFO] Detected and installed adapter: org.apache.cayenne.dba.sqlite.SQLiteAdapter [INFO] Connecting to 'jdbc:sqlite:/tmp/kundeninteressen.sqlite3' as 'null' [INFO] +++ Connecting: SUCCESS. [INFO] Detected and installed adapter: org.apache.cayenne.dba.sqlite.SQLiteAdapter [INFO] Connecting to 'jdbc:sqlite:/tmp/kundeninteressen.sqlite3' as 'null' [INFO] +++ Connecting: SUCCESS. [INFO] Detected and installed adapter: org.apache.cayenne.dba.sqlite.SQLiteAdapter [INFO] Connecting to 'jdbc:sqlite:/tmp/kundeninteressen.sqlite3' as 'null' [INFO] +++ Connecting: SUCCESS. [INFO] Table: Interessen [INFO] Table: Kunden [INFO] Table: KundenInteressen [INFO] Table: Laender [INFO] no attribute for declared primary key: [INFO] no attribute for declared primary key: [INFO] no attribute for declared primary key: [INFO] [INFO] Map file does not exist. Loaded db model will be saved into '/home/ali/ws/autoimport/src/main/resources/datamap.map.xml' [INFO] [INFO] Detected changes: [INFO] Create Table Kunden [INFO] Create Table Laender [INFO] Create Table KundenInteressen [INFO] Create Table Interessen [INFO] [INFO] Migration Complete Successfully. [INFO] Loading XML configuration resource from file:/home/ali/ws/autoimport/src/main/resources/cayenne/cayenne-project.xml [INFO] Loading XML DataMap resource from file:/home/ali/ws/autoimport/src/main/resources/cayenne/datamap.map.xml [INFO] [INFO] All changes saved. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.489 s [INFO] Finished at: 2022-07-22T15:18:59+02:00 [INFO] ------------------------------------------------------------------------
kundeninteressen.sqlite3
Description: application/vnd.sqlite3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>mygroup</groupId> <artifactId>autoimport</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <cayenne.version>4.2.RC1</cayenne.version> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <build> <plugins> <plugin> <groupId>org.apache.cayenne.plugins</groupId> <artifactId>cayenne-maven-plugin</artifactId> <version>${cayenne.version}</version> <configuration> <cayenneProject>${project.basedir}/src/main/resources/cayenne/cayenne-project.xml</cayenneProject> <map>${project.basedir}/src/main/resources/datamap.map.xml</map> <dataSource> <url> jdbc:sqlite:/tmp/kundeninteressen.sqlite3 </url> <driver> org.sqlite.JDBC </driver> </dataSource> <dbimport> <defaultPackage>mypkg</defaultPackage> <includeTable>.*</includeTable> <skipRelationshipsLoading>false</skipRelationshipsLoading> <skipPrimaryKeyLoading>false</skipPrimaryKeyLoading> </dbimport> </configuration> <dependencies> <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.36.0.3</version> </dependency> </dependencies> </plugin> </plugins> </build> </project>