title: Spring Boot spring.datasource.schema VS spring.jpa.properties.hibernate.default_schema
body: <p>Recently, I begin to use Spring Boot for web app development.</p>
  
  <p>This is my .properties file content:</p>
  
  <pre><code>#data source configuration
  spring.datasource.url=jdbc:postgresql://localhost:5432/sampledb
  spring.datasource.schema=sample
  spring.datasource.username=postgres
  spring.datasource.password=postgres
  spring.datasource.driver-class-name=org.postgresql.Driver
  #spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.datasource.minimumIdle=3
  spring.datasource.maximumPoolSize=5
  
  
  
  #jpa properties configuration
  #spring.jpa.show-sql=false
  spring.jpa.databasePlatform=org.hibernate.dialect.PostgreSQL82Dialect
  spring.jpa.properties.hibernate.show_sql=true
  spring.jpa.hibernate.ddl-auto=validate
  #spring.jpa.properties.hibernate.default_schema=sample
  </code></pre>
  
  <p>This part of my entity class:</p>
  
  <pre><code>@Entity
  @Table(name = "sample_info")
  public class SampleInfo implements Serializable{
  
      private Long id;
      private String code;
      private Long serialNumber;
  
      @Id
      @GeneratedValue(
              strategy = GenerationType.SEQUENCE,
              generator = "sample_info_seq_gen"
      )
      @SequenceGenerator(
              name = "sample_info_seq_gen",
              sequenceName = "sample_info_seq",
              allocationSize = 1
      )
      @Column(name = "id")
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  </code></pre>
  
  <p>Based on .properties above, the issue is every time I try to save new SampleInfo using Spring Data JPA repository, i always get error sequence "sample_info_seq" not found.</p>
  
  <p>If I comment spring.datasource.schema=sample and uncomment spring.jpa.properties.hibernate.default_schema=sample, everything works fine.</p>
  
  <p>I do not know the differences between those two, anyone can help?</p>