Hello, my name is Aleksander M. Stensby.
Last week I posted a question (obviously in the wrong place) on the hibernate-dev mailing list.
Mr. Emmanuel Bernard was kind to direct me here, and to also answer part of my question.
Quote:
To answer your question, you have different DBs, so different SessionFactory configurations (using the same mapping I imagine).
You will just have to change the following property in each hibernate.cfg.xml
hibernate.search.default.indexBase /usr/local/lucene/indexes/dbXX
Problem is, we make use of Spring's AbstractRoutingDataSource (as proposed by
Interface21 blogger Mark Fisher). Mainly, we do this because from what we have read, multiple session factories does not scale with regard to being resource intensive etc.
So, it boils down to the following:
We have multiple databases(schemas) with the exact same design (domain model) but obviously different content.
We have one session factory, mapped to one datasource, which in turn is an implementation of an AbstractRoutingDataSource. This again maps several datasources, each representing the different databases. So, they get their connection.url from a hibernate.properties file. Nice, it works.
But, here comes the challenge and my question:
We would like to migrate from pure lucene to hibernate-search. We want to make use of hibernate events and auto-indexing. Only problem is, since we do not have X number of session factories, how can we map the different "indexBase" paths in the same way as we did with datasources?
Ideally (in my dream world), I would just add the path the same place we differentiate between db connection url's.. (e.g. in the datasource configuration).
Is there any way to accomplish this, or do we have to make use of multiple sessionfactories to do so?
Thanks for any answers, and please let me know if this was not clear in any way :)
Hibernate version: 3.2.4.sp1
Name and version of the database you are using: MySQL 5.0