title: Relation and differences between spring.jpa.generate-ddl and spring.jpa.hibernate.ddl-auto
body: <p>For a <code>Spring Boot</code> app (2.4.1) working with <code>Spring Data JPA</code>, with <code>@Entity</code> classes based with the <code>javax.persistence</code> annotations. For a <code>application.properties</code> exists these two properties:</p>
  <ul>
  <li>spring.jpa.generate-ddl</li>
  <li>spring.jpa.hibernate.ddl-auto</li>
  </ul>
  <p>Thanks to STS, the following descriptions are available:</p>
  <p><strong>spring.jpa.generate-ddl</strong></p>
  <pre><code>spring.jpa.generate-ddl
  java.lang.Boolean
  
  Default: false
  
  Whether to initialize the schema on startup.
  </code></pre>
  <p><strong>spring.jpa.hibernate.ddl-auto</strong></p>
  <pre><code>spring.jpa.hibernate.ddl-auto
  java.lang.String
  
  DDL mode. This is actually a shortcut for the &quot;hibernate.hbm2ddl.auto&quot; property. 
  Defaults to &quot;create-drop&quot; when using an embedded database and no schema manager was detected. 
  Otherwise, defaults to &quot;none&quot;
  </code></pre>
  <ul>
  <li>When is used the <code>spring.jpa.generate-ddl</code>?</li>
  <li>When is mandatory use the <code>spring.jpa.generate-ddl</code> approach? What scenario?</li>
  </ul>
  <p>I did realise that it is ignored and really is mandatory use <code>spring.jpa.hibernate.ddl-auto</code>, it for the following scenario: The schema is created through the <code>schema.sql</code> file for H2 and <code>spring.jpa.hibernate.ddl-auto</code> is <em>none</em>, in this case <code>spring.jpa.generate-ddl</code> is totally ignored</p>
  <p>Therefore:</p>
  <p>What is the relation (if exists) and differences between <code>spring.jpa.generate-ddl</code> and <code>spring.jpa.hibernate.ddl-auto</code>?</p>
  <p>I found these posts, and in someway is not clear when is mandatory use <code>spring.jpa.generate-ddl</code></p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/55575505/h2-schema-still-generated-when-spring-jpa-generate-ddl-false">H2 schema still generated when spring.jpa.generate-ddl=false</a></li>
  <li><a href="https://stackoverflow.com/questions/52766163/hibernate-annotation-relations-does-not-work-with-spring-jpa-generate-ddl-true">Hibernate Annotation relations does not work with spring.jpa.generate-ddl=true</a></li>
  <li><a href="https://stackoverflow.com/questions/60989934/tables-not-creating-in-spring-boot-v2-2-6-release-postgres">tables not creating in spring boot v2.2.6.RELEASE postgres</a></li>
  </ul>