It's fine to do that but you with need to configure 20 session factories, one for each db, and write some code of your own to make sure that te right one is used for each user session.
I've done this myself before for 8 databases. It worked ok but the problem comes when you want to start using a second level cache. I'm not sure they are set up to work out of the box in the scenario you describe. The main problem is with primary keys where your keys are unique in each schema but probably not unique across all 20 schemas.
I would recommend merging all schema's into one if possible, otherwise either don't use a second level cache (not recommended!) or tread carefully.
|