code: public boolean existsPage(String title) {
  
          if (title == null || title.length() == 0) {
              return false;
          }
  
          Title t;
          try {
  			t = new Title(title);
  		} catch (WikiTitleParsingException e) {
  			return false;
  		}
  		String encodedTitle = t.getWikiStyleTitle();
  
      	Session session = this.__getHibernateSession();
          session.beginTransaction();
          String query = "select p.id from PageMapLine as p where p.name = :pName";
          if(dbConfig.supportsCollation()) {
              query += SQL_COLLATION;
          }
          Object returnValue = session.createNativeQuery(query)
              .setParameter("pName", encodedTitle, StringType.INSTANCE)
              .uniqueResult();
          session.getTransaction().commit();
  
          return returnValue != null;
      }
docs: Tests, whether a page or redirect with the given title exists.
  Trying to retrieve a page that does not exist in Wikipedia throws an exception.
  You may catch the exception or use this test, depending on your task.
  @param title The title of the page.
  @return {@code True}, if a page or redirect with that title exits, {@code false} otherwise.