Im working with hibernate and mysql, and i got it working to put data in the DB via hibernate, but when i try to retrieve data it always returns null...
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
User user = (User) session.get(User.class, username);
session.getTransaction().commit();
User is a class with annotations, but the variable user will always be null, even if i put a username that i know exists in the DB. Username is the ID of the table, so it should find it
EDIT
Can it be that i use <property name="hbm2ddl.auto">create</property>
in the config? What should i use so the DB create the table only if it does not exist?