Hibernate error when trying to use the ControlsFx library

0

What I want to try is that when writing something in my textfield it is self-completed with information from my Database

Here I declare the The text box that I want the completed car to make

@FXML
private TextField txtGeneracion;

Class java RegisterAlumno.

  autocomplete service = new autocomplete();



    TextFields.bindAutoCompletion(txtGeneracion, t-> {

        return service.getSuggestions("code", t.getUserText());

    });

Self-complete java class.

@SuppressWarnings ("unchecked")

    public List<String> getSuggestions(String fieldName, String searchString) {


        List<String> list = null;

        HibernateUtil.openSession().getSessionFactory().close();;

        Session s = HibernateUtil.openSession().getSessionFactory().openSession();

        try {

            s.beginTransaction();

            Query query = s.createQuery("select Generacion from alumno");

            list = query.setParameter("search", "%"+searchString+"%").setMaxResults(10).list();

            s.getTransaction().commit();

        } catch (Exception ex) {

            JOptionPane.showMessageDialog(null, "Error");

        } finally {

            s.close();

        }       

        return list;

    }

Note: I am using a library called Java ControlsFx is .jar and I have already added it to the library

Error:

At the moment that I write something that exists in the database, it marks those red lines and nothing else does not make me complete the auto effect.

    
asked by David 17.10.2016 в 05:08
source

1 answer

0

This may work for you, take a look. link

    
answered by 17.10.2016 в 17:04