ninja icon indicating copy to clipboard operation
ninja copied to clipboard

can you give one Multiple datasources example

Open 01coding opened this issue 6 years ago • 5 comments

01coding avatar Apr 27 '18 02:04 01coding

Maybe my solution can help you. It also uses HikariCP to setup connection pools for each of the database source.

https://github.com/miketeo/ninja-multidb-demo

miketeo avatar Jul 12 '18 10:07 miketeo

Hey Mike, that looks really cool!

We were experimenting with the following approach: https://github.com/ninjaframework/ninja-db Do you think it would make sense to add your approach as part of ninja-db?

Jpa is missing there...

raphaelbauer avatar Aug 08 '18 20:08 raphaelbauer

@raphaelbauer : ninja-db looks interesting. The JPA mechanism used in the current ninja framework is sufficient for common use cases. ninja-db will empower the developer to use ninja framework for more complex requirements.

I have another demo (https://github.com/miketeo/ninja-multitenantdb-demo) which demonstrates using Ninja framework to support multi-tenant databases. Should be pretty useful for those who are looking to develop SaaS platforms using Ninja.

I will look into ninja-db over the next few weeks. On the first look, I have yet to figure out where to implement database transactions in the current ninja-db architecture.

miketeo avatar Aug 10 '18 13:08 miketeo

@miketeo hi Which is better, your multi-tenancy or ninja-db?

AllExample avatar Nov 03 '20 06:11 AllExample

I don't think ninja-db supports multi-tenancy out-of-the-box, although you can use the same schema across multiple datasources to create a similar multi-tenancy result. But you might still need to come up with a solution to deal with the issue of dynamically adding and removing datasources from the "tenancy" list.

miketeo avatar Nov 03 '20 17:11 miketeo