开发者

grails console issue : No Hibernate Session bound to thread,

开发者 https://www.devze.com 2022-12-24 19:37 出处:网络
i\'m trying to learn Grails console and had a problem.It looks like this: When I start grails console in my project WITHOUT starting the project, I can persist data to my postgreSQL database.

i'm trying to learn Grails console and had a problem. It looks like this:

When I start grails console in my project WITHOUT starting the project, I can persist data to my postgreSQL database.

However, when I started the project (aft开发者_如何学Cer a bunch of error messages from netbeans output), I cannot do what I did anymore from Grails console.

It says this:

Exception thrown: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

....

That means, I lost Hibername Session while starting my project via netbean......

Could some one give me hand?

Thanks so much in advance!

john


Use DomainClass.withTransaction{

}

0

精彩评论

暂无评论...
验证码 换一张
取 消