Skip to content

How to deal wiith querydsl multiple schema have same table name?

Simply I faced a problem when trying to access query DSL with multiple schemas, I added multiple schemas as below

<schemaPattern>ABC,DEF</schemaPattern>

and my table name pattern is

<tableNamePattern>PQR,STU</tableNamePattern>

suppose both schemas have DEF table then when I compile maven project it gives me the below error.

Failed to execute goal com.querydsl:querydsl-maven-plugin:4.2.1:export (default) on project TestProject:
Execution default of goal com.querydsl:querydsl-maven-plugin:4.2.1:export failed: Attempted to write multiple times to D:testrepostestProjecttargetgenerated-sourcestestPackagedomaindependencyQDEF.java, please check your configuration

Can anyone tell me a way to resolve this and also can explain how to access generated classes in specific schema(for example I want to declare QDEF qdet = QDEF.qdef , this is normal way, but how can I declare QDEF in STU schema)?

Answer

I believe this was resolved here. It looks like <schemaToPackage>true</schemaToPackage> is what you need.