session.getTransaction().commit();
}
}
在 Junit 测试类中执行建表方法 createTable,后台打印输出的 SQL 语句 :
drop table if exists user
create table user (
id integer not null auto_increment,
name varchar(18) not null,
mail varchar(40) not null,
registerDate datetime not null,
recentLoginTime time,
lastLoginDay date,
primary key (id)
)
数据库中生成的表结构 :

在 Junit 测试类中执行插入数据的方法 insert,后台打印输出的 SQL 语句 :
Hibernate:
insert
into
user
(mail, lastLoginDay, name, recentLoginTime, registerDate)
values
( , , , , )
数据库中的数据 :
