Configuration config=new Configuration().configure();
SessionFactory sessionFactory=config.buildSessionFactory();
Session session=sessionFactory.openSession();
Transaction tx=session.beginTransaction();
CustomerMessage message=new CustomerMessage();
message.setName(name);
message.setEmail(email);
message.setNr(nr);
session.save(message);
tx.commit();
session.close();
执行以上代码后 没有出错信息 但是也不能向数据库中保存数据
SessionFactory sessionFactory=config.buildSessionFactory();
Session session=sessionFactory.openSession();
Transaction tx=session.beginTransaction();
CustomerMessage message=new CustomerMessage();
message.setName(name);
message.setEmail(email);
message.setNr(nr);
session.save(message);
tx.commit();
session.close();
执行以上代码后 没有出错信息 但是也不能向数据库中保存数据
配置文件 是不是 CustomerMessage 对应的表 没有!