title: Quarkus: Named datasources, multitenancy and persistence units
body: <p>I have a project with 2 datasources, a primary and a fallback datasource. I have added these to applications.properties and I am using the DATABASE multitenancy approach. I have a custom TenantResolver implementation that changes the active tenant, and the only entities I have defined are in an external module.</p>
  <p>The issue is simply this: saving to both of my datasources works just fine, however in order to get the app to start I have to include a dummy datasource:</p>
  <pre><code>quarkus.datasource.db-kind=h2
  quarkus.datasource.jdbc.url=dummy
  </code></pre>
  <p>in the properties file. Otherwise I get the error:
  The default datasource is not configured but the persistence unit '' uses it.
  The actual datasources I'm using are defined like so:</p>
  <pre><code>quarkus.datasource.primary.jdbc.url=jdbc:postgresql://...
  quarkus.datasource.secondary.jdbc.url=jdbc:postgresql://...
  </code></pre>
  <p>and saving to them works just fine.</p>
  <p>So the question is: how should i configure my application so I don't have to include this dummy datasource to avoid the persistence unit error?</p>
  <p>Here is the entire properties file:</p>
  <pre><code># Enable DATABASE approach
  quarkus.hibernate-orm.multitenant=DATABASE
  
  quarkus.datasource.db-kind=h2
  quarkus.datasource.jdbc.url=dummy
  
  # Primary tenant
  quarkus.datasource.primary.db-kind=postgresql
  quarkus.datasource.primary.username=reportinguser
  quarkus.datasource.primary.password=pw123
  quarkus.datasource.primary.jdbc.url=jdbc:postgresql://localhost:5432/reportingdb1
  
  # Secondary tenant
  quarkus.datasource.secondary.db-kind=postgresql
  quarkus.datasource.secondary.username=reportinguser2
  quarkus.datasource.secondary.password=password
  quarkus.datasource.secondary.jdbc.url=jdbc:postgresql://localhost:5432/reportingdb1
  </code></pre>