title: SQLServerException: Invalid object name
body: <p>I made this little prototype with Spring Boot, working fine with a Postgres database, but I had to change it to an MSSQL container, and now I get this SQLServerException.</p>
  <p>This is what I have got:</p>
  <ul>
  <li>An entity called StructuralElement</li>
  <li>the table structural_element, and I put an entry in this table by hand.</li>
  <li>The database is an MSSQL container with the database name &quot;master&quot; and schema name &quot;dbo&quot;.</li>
  <li>a JpaRepository called StructuralElementRepository</li>
  </ul>
  <p>I get the exception every time the <code>.getAll()</code> method of the repository is called.
  I'm not sure what's going on, but I guess hibernate/jpa can't make the connection to the correct table?</p>
  <p>The flyway script</p>
  <pre><code>CREATE TABLE dbo.StructuralElement
  (
      id          INT IDENTITY (1,1) NOT NULL,
      name        NVARCHAR(128)      NULL,
      description NVARCHAR(4000)     NULL,     -- could also be NTEXT
      sequel      INT                NOT NULL, -- order within the Hierarchy
      FK_parent   INT                NULL      -- Hierarchy
  );
  </code></pre>
  <p>The application.properties</p>
  <pre><code>server.port=8080
  
  # JPA / Hibernate
  spring.jpa.show-sql=true
  spring.jpa.hibernate.ddl-auto=none
  spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
  spring.jpa.generate-ddl=false
  
  #Database Connection
  spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
  spring.datasource.url=jdbc:sqlserver://localhost:1433;database=master
  spring.datasource.username=sa
  spring.datasource.password=prototype_2020
  
  spring.flyway.schemas=dbo
  spring.flyway.locations=classpath:db/migration
  spring.flyway.placeholders.schemaName: dbo
  </code></pre>
  <p>The entity</p>
  <pre><code>@Data
  @SuperBuilder
  @Entity
  @NoArgsConstructor
  @AllArgsConstructor
  @Table(name = &quot;StructuralElement&quot;)
  public class StructuralElement {
  
      @Id
      private Long id;
  
      private String name;
  
      private String description;
  
      private Long sequel;
  </code></pre>
  <p>The repository</p>
  <pre><code>@Repository
  public interface PlanstellenRepository extends JpaRepository&lt;Planstelle, Long&gt; {
      
  }
  </code></pre>
  <p>This is my pom.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.3.4.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.prototype&lt;/groupId&gt;
      &lt;artifactId&gt;userservice&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;userservice&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;15&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.flywaydb&lt;/groupId&gt;
              &lt;artifactId&gt;flyway-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.microsoft.sqlserver&lt;/groupId&gt;
              &lt;artifactId&gt;mssql-jdbc&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                      &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.modelmapper&lt;/groupId&gt;
              &lt;artifactId&gt;modelmapper&lt;/artifactId&gt;
              &lt;version&gt;2.3.8&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;15&lt;/source&gt;
                      &lt;target&gt;15&lt;/target&gt;
                      &lt;release&gt;15&lt;/release&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p>EDIT: Changed to correct flyway script.</p>