Ciao, ho delle tabelle con dei campi DATE, devo fare un confronto con dei parametri che ricevo in POST, ho provato cosi
codice:
public Periodo getId(Object in, Object out){
        Query query=em.createQuery("select object(o) from Periodo as o WHERE ((o.in>?1) and (o.out<?2))");
        DateFormat df = new SimpleDateFormat ("dd-M-yyyy");
        df.setLenient (false);
        Date d=null;
        try{
        d = df.parse (in.toString());
        }catch(ParseException pse){}
        query.setParameter(1, d, TemporalType.DATE);
        try{
        d = df.parse (out.toString());
        }catch(ParseException pse){}
        query.setParameter(2,d, TemporalType.DATE);
        System.out.println("ok"+query.toString()+"ookk"+d.toString());
        return (Periodo)query.getSingleResult();
    }
ma mi da questo errore:

codice:
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in, out FROM periodo WHERE ((in > '2009-06-18') AND (out < '2009-06-12'))' at line 1 Error Code: 1064 Call: SELECT id, in, out FROM periodo WHERE ((in > ?) AND (out < ?))         bind => [2009-06-18, 2009-06-12]
Qualcuno mi sa dire dove sto sbagliando, Grazie