java - Hibernate data export / import for a single tenant -


i have posted quite general question implementing multi-tenant solution using specific technologies in past. have more specific question hoping input on.

for our multi-tenant application have requirement export single tenant's data 1 database database. example, our db might contain 10 tenants' data 1 of these 10 tenants wants have own instance of application (for whatever reasons, e.g. require specific customizations).

so want able write "tool" take data tenant x , move it's own database.

we using mysql database , latest version of hibernate core , annotations.

the way have implemented multi-tenancy add tenant id our tables / base class our entities extend.

originally thought use this:

mysqldump -uusername -ppassword database_name -w "tenant_id=1" > dump.sql 

but unfortunately @jointables not have tenant_id fails.

my question is: have ideas how export single tenant's data , import new database (which guess can create using standard hibernate schemaexport)?

i had 1 idea me implement need hibernate create db schema no constraints on , pump data in , need put constraints on db post import. have no idea how hibernate not add constraints @ first , later though if has idea please let me know.

thanks


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -