为了账号安全,请及时绑定邮箱和手机立即绑定

Test类运行成功,数据库却没有更新数据

三月 11, 2018 4:17:30 下午 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
三月 11, 2018 4:17:30 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.4.Final}
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/imooc/entity/Student.hbm.xml
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/imooc/entity/Grade.hbm.xml
三月 11, 2018 4:17:30 下午 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
三月 11, 2018 4:17:30 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
三月 11, 2018 4:17:30 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
三月 11, 2018 4:17:30 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
三月 11, 2018 4:17:30 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/imooc]
三月 11, 2018 4:17:30 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
三月 11, 2018 4:17:30 下午 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
三月 11, 2018 4:17:30 下午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
三月 11, 2018 4:17:30 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
三月 11, 2018 4:17:30 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory

正在回答

2 回答

Transaction事务成功提交了, 那你看看你配置文件中的数据库生成策略是否正确?是create还是update?


0 回复 有任何疑惑可以回复我~

事务没有提交

1 回复 有任何疑惑可以回复我~
#1

如今正好 提问者

Session session=HibernateUtil.getSession(); Transaction tx=session.beginTransaction(); session.save(g); session.save(stu1); session.save(stu2); tx.commit(); HibernateUtil.closeSession(session); 怎样才能成功提交呢
2018-03-13 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Hibernate初探之一对多映射
  • 参与学习       42171    人
  • 解答问题       295    个

Hibernate中一对多关联映射配置,以及cascade和inverse属性作用

进入课程

Test类运行成功,数据库却没有更新数据

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信