title: org.hibernate.hql.internal.ast.QuerySyntaxException: Apartment is not mapped [from Apartment]
body: <p>I have springboot rest appplication with Hibernate and MySQL. I have this error:</p>
  <blockquote>
  <p>nested exception is
  org.springframework.dao.InvalidDataAccessApiUsageException:
  org.hibernate.hql.internal.ast.QuerySyntaxException: Apartment is not
  mapped [from Apartment]</p>
  </blockquote>
  <p>But I dont know where I have a mistake. I have two tables: Apartments and Residents in DB. But now I try only getAllApartments() method. I use Intellij and I even checked my DB in her. And I have little picture near my Entity class, where I have correct data source. And I think that I checked names my class and fields.</p>
  <p>This is my Entity:</p>
  <pre><code>@Entity
  @Table(name = &quot;Apartments&quot;)
  public class Apartment {
  
  @Column(name = &quot;apartment_id&quot;)
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Integer apartmentId;
  
  @Column(name = &quot;apartment_number&quot;
  private Integer apartmentNumber;
  
  @Column(name = &quot;apartment_class&quot;)
  private String apartmentClass;
  
  @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH, CascadeType.REFRESH},
          mappedBy = &quot;apartment&quot;)
  List&lt;Resident&gt; residentList;
  </code></pre>
  <p>My DAO method:</p>
  <pre><code>@Repository
  public class ApartmentDAOImpl implements ApartmentDAO {
  
  @Autowired
  private EntityManager entityManager;
  
  @Override
  public List&lt;Apartment&gt; getAllApartment() {
      Session session = entityManager.unwrap(Session.class);
      Query query = session.createQuery(&quot;from Apartment&quot;);
      List&lt;Apartment&gt; apartmentList = query.getResultList();
      return apartmentList;
  }
  </code></pre>
  <p>My Controller:</p>
  <pre><code>@RestController
  @RequestMapping(&quot;/api&quot;)
  public class ApartmentController {
  
  @Autowired
  ApartmentService apartmentService;
  
  @GetMapping(&quot;/apartments&quot;)
  public List&lt;Apartment&gt; getAllApartments() {
      List&lt;Apartment&gt; apartmentList = apartmentService.getAllApartment();
      return apartmentList;
  }
  </code></pre>
  <p>I also have service layer without any logic.
  My property.file</p>
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/correct_db?useSSL=false&amp;serverTimezone=UTC
  spring.datasource.username=projuser
  spring.datasource.password=projuser
  </code></pre>
  <p>Give me advice, please.</p>