How To Solve “Caused by: org.hibernate.HibernateException: Missing table” When Table Is Present In Database

If you are using JPA or Hibernate directly and got that exception while starting your application, there is one obvious reason for that. You forgot to add that table in MySQL database or any other database that you are using. But if the table is present, then most likely it is a database user permission issue. Suppose you are using MySQL, then you will have to provide a MySQL username & password with database connection url so that Hibernate can connect to the database from your Java application. That might be different than the MySQL user you used to connect to the database directly & create the table. To check, use the same MySQL username & password used in your Java application & connect to database console directly. Run a select query on the table. If you get some access denied error like “ERROR 1142 (42000): SELECT command denied to user”, that means you need to grant access to this database user for this particular table. And that should solve the problem.

Leave a Comment