All pastes #809197 Raw Edit

babbitt

public java v1 · immutable
·published 2007-12-08 10:52 UTC
rendered paste body
        jComboBox1.addActionListener(new ActionListener(){            public void actionPerformed(ActionEvent e){                System.out.println("Caught Action...");                JComboBox cb = (JComboBox) e.getSource();                //Set the active card's type based on the selection                String selected = (String) cb.getSelectedItem();                                System.out.println("Querying for Type...");                //Find the appropriate type                Session session = HibernateUtil.getSession();                Query query = session.createQuery("from Type where name = ?");                query.setText(0, selected);                query.setMaxResults(1);                                //Retreive and set the appropriate type                Type t = (Type) query.uniqueResult();                                System.out.println("Found unique result, " + t.getName());                activeCard.setType(t);                                //Save the card                session.saveOrUpdate(activeCard);                session.close();            }        });