lundi 17 février 2020

How to set a class Name as a method's parameter?

I would like to send a class name as a parameter of method. I would like to use(execute) it like that.

 orderDao.getTheMostFrequentType(EmployeeOrder.class);

I have this code

@Override
        public String getTheMostFrequentType(Class<T> orderClass){


          String tableName = orderClass.getAnnotation(Table.class).name();

          String sqlQuery = "SELECT STATS_MODE(signed_by_id) FROM " + tableName;

          String result = (String)getSessionFactory().getCurrentSession().createSQLQuery(sqlQuery).uniqueResult();

        return result;
      }

But it executing attempts gives me:

May be there is another classes should i import instead of apache.poi. But which one?

getTheMostFrequentType("org.apache.poi.ss.formula.functions.T") method cannot be aplied in "java.lang.entities.EmployeeOrder"

What i do wrong?





Aucun commentaire:

Enregistrer un commentaire