<plugin>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-maven-plugin</artifactId>
<version>${querydsl.version}</version>
<executions>
<execution>
<goals>
<goal>export</goal>
</goals>
</execution>
</executions>
<configuration>
<jdbcDriver>${pacifique.datasource.driver-class-name}</jdbcDriver>
<jdbcUrl>${pacifique.datasource.url}</jdbcUrl>
<jdbcUser>${pacifique.datasource.username}</jdbcUser>
<jdbcPassword>${pacifique.datasource.password}</jdbcPassword>
<packageName>fr.hm.pacifique.sql</packageName>
<targetFolder>${project.basedir}/target/generated-sources</targetFolder>
<sourceFolder>${project.basedir}/fr.hm.pacifique.domain</sourceFolder>
<tableNamePattern>sui_tr_log</tableNamePattern>
<exportInverseForeignKeys>false</exportInverseForeignKeys>
<innerClassesForKeys>true</innerClassesForKeys>
<renameMappings>
<renameMapping>
<fromTable>sui_tr_log</fromTable>
<toTable>message</toTable>
</renameMapping>
</renameMappings>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
</dependencies>
</plugin>
Renaming a table:
<renameMappings> <renameMapping> <fromSchema>PROD</fromSchema> <fromTable>CUSTOMER</fromTable> <toTable>CSTMR</toTable> </renameMapping> </renameMappings>
Hi,
So if you run the Maven job in verbose mode, it does not throw any related error?
If you don’t get anywhere, perhaps consider codegen programmatically, so that you can just run a class which will updates your table beans whenever you make changes to your DB.
Regards
Luisa
Sent from Mail for Windows 10
--
You received this message because you are subscribed to a topic in the Google Groups "Querydsl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/querydsl/s1AJbJJ6jxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to querydsl+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/querydsl/757468db-2f84-49f6-af1b-48059685dd6c%40googlegroups.com.
Ps
I am assuming that by renaming a table you mean represent a table called A in your DB as something called B in your code.
That is my understand of what a mapping should do, it will not rename the table name in your db itself.
If find evidence of otherwise please let me know
Sent from Mail for Windows 10
From: Maths via Querydsl
Sent: 09 December 2019 15:58
To: Querydsl
Subject: Re: Querydsl - sql : Rename a table
Hi Luisa,
Thanks for your answer.
I have no errors, just my table is not rename (I got QSuiTrLog). => Maybe I don't understand how it's working ?
My objective : if the name of my table change, I don't want to change my code (only change the pom).
I try also with <fromSchema> tag but it doesn't work and in the doc : "Note: fromSchema can be omitted when renaming tables and columns." http://www.querydsl.com/static/querydsl/4.2.1/reference/html/ch02s03.html
Regards,
Fabien
--
You received this message because you are subscribed to a topic in the Google Groups "Querydsl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/querydsl/s1AJbJJ6jxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to querydsl+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/querydsl/871bf3e4-a338-4c95-87ec-ae4c3bf586f5%40googlegroups.com.
Hi,
--
You received this message because you are subscribed to a topic in the Google Groups "Querydsl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/querydsl/s1AJbJJ6jxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to querydsl+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/querydsl/f641c374-0941-4946-ab54-518656dd7ed0%40googlegroups.com.
<target name="codegen">
<taskdef name="codegen" classpathref="pacifique-socle-batch-app.module.classpath"
classname="com.querydsl.sql.codegen.ant.AntMetaDataExporter"/>
<codegen
jdbcDriver="org.postgresql.Driver"
jdbcUser="postgres"
jdbcPassword="root"
jdbcUrl="jdbc:postgresql://localhost:5432/pacifique"
packageName="empty"
targetFolder="build"
tablenamepattern="sui\_t\_%,ref_tr_contexte,exp_moo_t_security"
exportinverseforeignkeys="false"
innerclassesforkeys="true">
<renamemapping fromschema="public" toschema="pub"/>
<renamemapping fromschema="PUBLIC" toschema="PUB"/>
<renamemapping fromschema="PUBLIC" fromtable="SUI_T_FLUX" toschema="PUB" totable="QFlux1"/>
<renamemapping fromschema="public" fromtable="sui_t_flux" toschema="pub" totable="QFlux2"/>
<renamemapping fromschema="public" fromtable="QSuiTFlux" toschema="pub" totable="QFlux3"/>
</codegen>
</target>
public QSuiTFlux(String variable) {
super(QSuiTFlux.class, forVariable(variable), "public", "sui_t_flux");
addMetadata();
}