MySql + Several Schemas - Problem on ManyToOne


#1

I have two tables (Entity). One is in Schema 1 and the other is in Schema 2.

Among them, there is a ManyToOne relationship, mapped in the Schema 2 class.

In both classes in the “@Table” annotation, there is an indication of the schema that each belongs.

Question : How can we indicate a value dynamically for this “@Table” annotation schema. Through a configuration file. And not fixedly, or set at design time / application compilation?

@Entity
@Table(name="protocolo_assunto",schema="adplan")

#2

You can use external XML mapping files to dynamically change the underlying association schema at build time.

Check out this article for more details.