Is it possible to use a custom query in the database replication module. I am not able to create views on the source database. Until now I have expanded the table.name attribute and put a query in that field between brackets. (Add manual adding tables and columns). So the query will result in: SELECT Alias.Number Number, Alias.Name Name from (SELECT Number, Name from TableName) Alias I have to adapt the query creation for that so I am no longer compatible with the appstore module. Is there a more elegant way? EDIT: Thanks Jasper: I changed both the DBReplicationSettings and ImportByMapping. The table entity has an extra enum type, values table/query. In the ui you can retrieve the columns from a query so metadata is complete and be used by import. In ImportByMapping no processing or escaping is done of the query. Query can only be used for a specific database. Works.
Chris de Gelder
Chris, the module is not designed to override the query, however you could achieve this by doing the following steps. All javasource, including the replication.jar is readable so you should be able to see the current implementation.
Extend the class databasereplication.implementation.DBReplicationSettings and override the getQuery() function with your own implementation
Copy the java action: databasereplication.actions.ImportByMapping.java and change the code to use your new DbReplicationSettings implementation.
This should be sufficient, however if you do this make sure you take a good look at the alias mapping in the original code replicationsettings code. The generated alias determines how the table and columns are mapped later on in the process.
Just let us know, If you get this to work and you have an suggestion on how to improve the code to make this easier for you so future db replication releases don't break your code.