Multitenancy: Hibernate with MySQL - mysql

Multi-Tenant Data Architecture
Separate Databases : Supported by Hibernate 4.0.
Shared Database, Separate Schemas : Supported by Hibernate 4.0.
Shared Database, Shared Schema : Planned for Hibernate 5.0 (DISCRIMINATOR).
However, (unlike Oracle or PostGre) MySQL doesn’t seem to have concept of schemas?, and so if I am using Hibernate + MySQL to achieve multitenancy, is it true that the only choice I am left over with is Separate Database?

I do not think so. You can create multiple schemas in a single data base in mysql.
So you can go with multiple schemas

You Can use : The Hibernate 4.0 ConnectionProvider
for the same you could switch over the appropriate tenant databases on a data base call when your session is trying to make a Connection to a datasource.
Please check with MultiTenantConnectionIdentifier and MultiTenantConnectionProvider availabled in Hibernate 4.0
For more help you can contact at : sonisatyam92#gmail.com

Related

Which databases Laravel supports and how can I add another one?

Based on some researches, I'm sure Laravel supports MySQL, SQLite, PostgreSQL by default. I mean we can just simply replace one of those database names with this:
Well I have two related questions:
Isn't there any list of all databases that Laravel supports by defaul? For example what about SQL Server? Can I just replace sqlserver with mysql, then does it work? In other word Does Laravel know sqlserver by default?
How can I add a new database to Laravel? For example (suppose sqlserver is not supported in Laraver by defaul) so how can I add sqlserver to Laravel?
Currently, Laravel 5.3 supports four databases:
MySQL
Postgres
SQLite
SQL Server (Driver 'sqlsrv')
Refer Laravel Docs - Database
Adding a new Database will always going to take great amount of efforts. Because you will need to write at least whole DB Façade (Forget about the Eloquent ORM Support) to maintain the cleanliness and ease of Laravel Framework.
This includes basic CRUD , database structures & Schema and Eloquent model and Query builder with support for your Database.
As Laravel supports most used SQL and No-SQL Databases by default, there are plenty of open source libraries for other databases, too.
For Example, Laravel MongoDB is a good open source library built using Laravel Core APIs.

mySql + Sql Server + Spring Jpa

This is more of a Q/A kind of question, i am looking for an example to replicate and learn.
Is there a way to use two different database at different servers from my spring application.
Currently my project uses MySql internally, so i have no issues to bind my JPA repositories or Entities file. It uses the database without any problem.
The problem is that i want to use one entity class that is a table in Sql server (entirely different from the mysql database that i am using currently for all entitiy class).
Please can you provide me example or the steps to be taken towards accomplishing this. I just want to point my Entity class to different database.
There is a whole example there.
You basically create 2 spring configurations, each defining its own DataSource bean.

Supporting multiple databases with entity framework

My client has an asp.net application - a product used my several customers. It connects to MSSQL database using good old ado.net and stored procedures. I am supposed to rewrite the application so that the application supports MySQL and Oracle in addition to MSSQL. I am supposed to use entity framework to do this. I am new to EF. So can any one guide me as to how this can be done? Where should I start?

Entity Framework Migrations - The underlying provider does not support the type 'nvarchar(max)'

I am converting my C# asp site to use a mysql db instead of the local db that the project is first built with. I am using two dbs, one for the built in account functionality, and one for the functionality that I have added.
The problem I have is that when the second db is seeding, I get the following message:
The underlying provider does not support the type 'nvarchar(max)'.
I'm assuming this is due to MS syntax that works with the .mdf db, but doesn't work with MySQL?
How do I go about solving this?

how shall I define sequences in my project (which uses hibernate) in a way that the project works with both Oracle and Mysql.

We have a java project that uses Hibernate as the OR Mapper. We need the project to work with both Oracle and Mysql. because some customers don't want to install Oracle. we have added #sequenceGenerator annotation on entities to have sequence. but the project can not connect to Mysql DBMS with these annotations. Is there any way that we can have sequences in both mysql and Oracle mode, without any changes?
Most portable way is to use TableGenerator. It is portable because no database provider specific constructs are used. Last generated value is stored to the database table, and value is retrieved and incremented via SQL queries.
Usage is also covered in Hibernate documentation.
in accordance to my knowledge it is not possible because
MySQL support AUTO_INCREMENT and Oracle support SEQUENCE
and there are many other factors to consider like data types and indexes
As Oracle is an ORDBMS where as mysql is DBMS it is lack of many features present in MySQL
SOLUTION
i think we can do this with separate databases for each of them
[ As we have many free tools to convert the data from Oracle to MySQL we can use them. Even some of them are not free but we can covert the structure usnig them link1 link2]
database migration needs a full understanding of the data types,indexes,column and table options,etc of both source and destination databases
or
you can use PostgreSQl which also supports SEQUENCES and it is also a GPL