Proper way to use mutliple databases in project

What is the proper way to use multiple databases? Do I create a new module for the entity beans for the new database or is there a way to annotate the entities with the database they should use?

I have a project that eventually may need to use about 4+ different databases in order to display all of the data needed.

Thanks!

2 Likes

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.

We just formulate some plans regarding support for multiple databases, please see this topic: https://www.cuba-platform.com/discuss/t/attach-external-databases#comment-1068