Querydsl: Attempted to write multiple times to …, please check your configuration

Created on 30 Jul 2018  ·  4Comments  ·  Source: querydsl/querydsl

With version 4.2.1 I get the error

https://github.com/querydsl/querydsl/blob/8f96f416270d0353f90a6551547906f3c217833a/querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java#L430

while using querydsl-maven-plugin together with jdbcDriver com.mysql.cj.jdbc.Driver (mysql-connector-java 8.0.11). This happens because the user I use to connect to MySQL has access to multiple databases. As a workaround I had to add nullCatalogMeansCurrent=true to jdbcUrl.

All 4 comments

Do you configure separate packages for the multiple schemas?
Or do you filter the schemas with a pattern?
Can you paint the picture a bit more, since it's intended to fail when the maven plugin detects the class was already generated.

I filter the tables via tableNamePattern, and tried to filter via schemaPattern, but this has no effect. (schema is always null, catalog is different depending on database name).

Edit1: db looks like this:

db1:
db1.Users
db2:
db2.Orders

https://github.com/querydsl/querydsl/blob/8f96f416270d0353f90a6551547906f3c217833a/querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java#L257

returns two items who look like this in MetaDataExporter::handleTable (pseudo json):

{catalog: db1, schema: null, tableName: Users}
{catalog: db2, schema: null, tableName: Users}

Edit2: I only use the schema db1. db2 is not used at all by my application, but the user happens to have access to it.

I have same issue !

Workaround : Create a new user in database which has access to only the given database for which you want to create Q files for. Done.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timowest picture timowest  ·  7Comments

robertandrewbain picture robertandrewbain  ·  5Comments

fe2s picture fe2s  ·  6Comments

beamofsoul picture beamofsoul  ·  6Comments

svaidya401 picture svaidya401  ·  4Comments