0

I have some classes (Teacher, Student...) and I want to create objects from them with fields backed from more database sources in a configurable way. The information where the data source is for a particular class field can be different depending on deployment (configuration of the App). I want to have the information about database sources persisted as well. (I use Hibernate for persisting.)

Example of deployment 1:

  • Teacher.firstname should be persisted from LDAP
  • Teacher.lastname should be persisted from LDAP
  • Teacher.email should be persisted from PostgreSQL
  • Student.firstname should be persisted from PostgreSQL
  • Student.lastname should be persisted from LDAP
  • Student.email should be persisted from PostgreSQL

So there needs to be also information persisted in some DB that Teacher.firstname is backed in LDAP, Teacher.email in PostgreSQL etc.

Example of deployment 2:

  • Teacher.firstname should be persisted from PostgreSQL
  • Teacher.lastname should be persisted from PostgreSQL
  • Teacher.email should be persisted from PostgreSQL
  • Student.firstname should be persisted from PostgreSQL
  • Student.lastname should be persisted from LDAP
  • Student.email should be persisted from PostgreSQL

So there needs to be also information persisted in some DB that Teacher.firstname is backed in PostgreSQL, Student.lastname in LDAP etc.

I use Spring (not only) for DI and JPA (Hibernate) for persistency, but it's not so important. I am not looking for an answer how to configure 2 datasources in Spring/JPA, but rather how to design that problem generally.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.