Alexander This is going to be a pretty big task, because of the number of tables no matter what you do. Is the problem that there are no foreign key relationships between your tables?
If you have the mapping file, you can always open that map with the Cayenne Modeler. It with that you can generate all the SQL for all the schema, of your database. You can even create a diagram of the database and the relationships between the tables using the Cayenne Modeler. The Cayenne Modeler will show you the relationships between the tables, even if they aren't present with foreign keys. Though, with 2000+ tables this may be challenging as the diagram tool in the Modeler is fairly simple. But with the Schema SQL you can create a new DB with your table structure and point any kind of modeling tool at that database. If you have the java classes that the modeler creates, you can also start looking in the java class files for the relationships between the objects. Again a daunting task, but certainly possible. I'm sure you can find a java tool, maybe class-visualizer, to document the relationships between the objects. If you don't have a mapping file with classes, but and just have a huge map with many sql statements in it, you could always pull them out of the map directly. Tony On Tue, Nov 13, 2018 at 3:25 AM Alexander Petrossian (PAF) < [email protected]> wrote: > Friends, please share your vision. > > I got a project with lots of Apache Cayenne mappings (2.0), and database is > not documented at all. > > All insights about links between tables (about 2 thousands of tables) I can > get is only from queries found in Cayenne mappings (several megabytes of > those). > > Those tables I can quick analyse with JSQLParser. But it needs raw SQLs. > > Question: Is there some easy way to programmatically iterate through all > queries and apply templates to get those raw SQLs? > > (Any hints would be very appreciated!) > > > > https://github.com/JSQLParser/JSqlParser/issues/710 > > https://sourceforge.net/p/jailer/feature-requests/52/ > > -- > PAF > > P.S. tried to discuss it here first: > https://jira.apache.org/jira/browse/CAY-2495 >
