【问题标题】:grails console issue : No Hibernate Session bound to thread,grails控制台问题:没有绑定到线程的休眠会话,
【发布时间】:2011-01-31 15:31:13
【问题描述】:

我正在尝试学习 Grails 控制台,但遇到了问题。它看起来像这样:

当我在我的项目中启动 grails 控制台而不启动项目时,我可以将数据保存到我的 postgreSQL 数据库中。

但是,当我开始项目时(在 netbeans 输出的一堆错误消息之后),我无法再从 Grails 控制台执行我所做的事情了。

上面写着:

抛出异常:没有 Hibernate Session 绑定到线程,并且配置不允许在此处创建非事务性会话

....

也就是说,我在通过 netbean 启动我的项目时丢失了 Hibername Session……

有人可以帮我吗?

提前非常感谢!

约翰

【问题讨论】:

    标签: hibernate grails console


    【解决方案1】:

    使用 DomainClass.withTransaction{

    }

    【讨论】:

      猜你喜欢
      • 2011-10-25
      • 1970-01-01
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-21
      • 2010-10-18
      相关资源
      最近更新 更多