Reputation: 235
My app connects with diferent databases. First of all, I generate the orm code with speedment for the first database. But when I try to connect to a newone Speedment deletes the code generated for the previous one.
Upvotes: 0
Views: 59
Reputation: 547
The Speedment Tool can't currently connect to more than one database, but there is a hack to get around this.
Speedment will generate code based on the speedment.json-file. When you connect to a new database, your speedment.json-file is overwritten and is therefore not used in the second pass. To get around this, save the original file as something else (like speedment2.json) and then connect to the second database. Instead of generating, simply press "Save". This will create a new speedment.json-file without generating code. Then open the created file in a text editor and add manually combine the files. Look for an value with the key "dbmses". It should be mapped to a list of objects, in the first file the object represents the first database and in the second file it represents the second database. If you combine these two lists, save the file and then reopen the UI, then you should see both the databases there. From here on you can use the tool to make changes and regenerate code as usual.
Upvotes: 1