title: How to make 2 unrelated entities (two repository) run in one project at the same time ? Is it possible?
body: <p>I'm trying to make 2 entities (that's not related) in one project. i'm using Java springboot to connect to mysql database. so what's the best way i can do? because i tried to make 2 repository but i only succeed 1 of them. another one is giving me an error. its giving me error even it's actually fine when i run the query in mysql workbench  </p>
  
  <p>in my repository (AccountRepository.java) that's not working, i put something like this:</p>
  
  <pre><code>public interface AccountRepository extends CrudRepository&lt;Accounts, Integer&gt; {
  
      @Query("SELECT applicationPassword FROM Accounts where applicationName = 'myApp'")
      String findPasswordApp();
  }
  </code></pre>
  
  <p>in the entity file (Accounts.java), i put something like this</p>
  
  <pre><code>@Entity
  public class Accounts {
      @Id
      private Integer accountID;
      private String applicationName;
      private String applicationPassword; 
      public void setAccountID(Integer accountID) {
          this.accountID = accountID;
      }
  
  public void setApplicationName(String applicationName) {
      this.applicationName = applicationName;
  }
  
  public void setApplicationPassword(String applicationPassword) {
      this.applicationPassword = applicationPassword;
  }
  
  public Integer getAccountID() {
      return accountID;
  }
  
  public String getApplicationName() {
      return applicationName;
  }
  
  public String getApplicationPassword() {
      return applicationPassword;
  }
  }
  </code></pre>
  
  <p>but it's giving me error. what i wanted from this entity is that i can check the value (read) in database that i already put it manually in mysql workbench.  </p>
  
  <p>and here is the table query that i execute first in mysl workbench</p>
  
  <pre><code>CREATE TABLE Accounts (
      accountID int,
      applicationName varchar(255),
      applicationPassword varchar(255)
  );  
  </code></pre>
  
  <p>and also here is when i succeed inserting data into it:</p>
  
  <pre><code>INSERT INTO Accounts (accountID, applicationName, applicationPassword)
  VALUES ('1', 'myApp', 'password'));
  </code></pre>
  
  <p>Is there anything wrong with my code ? please help</p>
  
  <p>Edit: i try to cover up with try catch on this line 'String password = accountRepository.findPasswordApp(); ' and that's giving me exception like 'java.lang.NullPointerException'</p>
  
  <p>here is my full exception :
      at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:499)
      at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:402)
      at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:206)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748) 
      '</p>