title: How to dynamically change schema in spring boot Entities?
body: <p>I am using spring boot(1.5.9 version) and MySQL,hibernate .In MySQL i am having two or more different <code>schema</code> ,Table1 present in schema1 and Table2 present in schema2,in my spring boot application.properties i have connected mysql schema1 database,i need to store the values in schema2.table2 in same port(3356).how to dynamically change the schema in Entity.</p>
  
  <p>application.properties</p>
  
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3356/schema1
  spring.datasource.username=root
  spring.datasource.password=12345
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  </code></pre>
  
  <p>Entity:</p>
  
  <pre><code>@Entity
  @Table(name = "table2", schema = "schema2")
  public class Company implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "CompanyID")
      private Integer id;
  
      @Column(name = "CompanyName")
      private String companyname;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'schema1.table2' doesn't exist
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_151]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_151]
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_151]
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_151]
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2487) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998) ~[mysql-connector-java-5.1.44.jar:5.1.44]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
      at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114) ~[tomcat-jdbc-8.5.23.jar:na]
      at com.sun.proxy.$Proxy106.executeUpdate(Unknown Source) ~[na:na]
  </code></pre>