it’s possible to attach an external SQL Database of an existing Financial program, and make relation with database created on CUBA (in SQL) and the attached database?
It’s my first project in Cuba, i like this tool. In the past, we are working with VS Lightswitch, and i have an application that communicates our financial tool, with the application. We are searching, for replace this tool with Cuba, but i cannot see any option to attach one or more databases and make relations with them.
One needed relation, it’s give customers from financial database on an entity of WorkItems (for tecnhicial tool) related.
Currently, CUBA application can map entities only to a single database, which is connected through the datasource located in JNDI by “jdbc/CubaDS” name (by default).
You can have additional datasources to connect to other databases, but you have to work with them through JDBC, or MyBatis, or create your own persistence unit for EclipseLink using standard JPA facilities (the last option is not yet tested). In order to display these data in standard CUBA UI, you can map the data to non-persistent entities of your standard data model."
Could you explain in more detail, what do you mean by relation with an additional database? How it worked on Lightswitch?
And what DBMS do you use?
Hi Konstantin, at this moment in Lightswitch we have an application database, and then we have 3 external databases attached,
I attach a word document with some captures:
Cuba, it’s a very good tool, but i mean that need only to connect visible for work and create views, or screen to other databases for work directly to these databases.
I’m afraid you cannot do the same in CUBA application. You have to write quite a lot of custom code to map data from additional databases to UI. We will try to address this issue in the future.
Could you provide a simplest use case for this feature? I mean some explanation what entity is in the main database, what is in the additional, how they are linked, how you display them in UI and whether you store changes back in the databases.
Ability to define connections to additional databases.
Ability to create persistent entities mapped to tables from additional databases.
Ability to work with these entities in UI and on middleware in the same way as with entities from the main database.
Entities from different databases can be linked, i.e. an entity from DB1 can have a reference to an entity from DB2.
When Studio reverse-engineers tables from databases, the structure of tables should remain untouched. It means that simplest CUBA entities should not require the creation of additional database columns.
We are going to implement these requirements in CUBA v.6.3 and Studio v.2.3 which is scheduled for September 2016.
Here are my comments on ability to connect to multiple databases.
Top priority for our use cases are items 1, 2, 3, 5. Preferably using JPA connections.
We would not need item 4 other than an audit log in DB1 would need to point to an entity in DB2. However, to have more strict reference (similar to a foreign key) would not be required in our case.
This is the case in the current version (6.2/2.2) too. Exceptions are:
Composite keys are not supported and replaced with a UUID key if there are no references to them.
MS SQL and MySQL identity keys are replaced with Long keys populated from sequences.
Our goal is to remove these exceptions, but honestly, the whole #5 it is the most difficult part of the issue.
Hi, for us we need to CUBA platform support external databases without changes. “As it”.
Normally, has certain Primary Key or Primary Keys in certains tables, and we need to make relation that this has trasnferred exactly as original database.
Remnember that Original Attached Databases, has the possibility to have changes , new fields, new tables (from original application of these database), and we need an option to update schema on Cuba to retrieve de new changes.
And we need to make relations on the original databases, and these relations has been saved on Cuba Platform.