views:

144

answers:

1

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 (after 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

+1  A: 

Use DomainClass.withTransaction{

}

Khurram Ijaz