This is a duplicate of HHH-11686.
More, the second query needs to be written like this:
List<Account> accounts = session .createQuery( "select a " + "from Account a " + "where treat(a as Loan).interest = 10") .getResultList();