File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Groovy and the fly likes get latest data from database into GORM after doing insert with stored procedure call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "get latest data from database into GORM after doing insert with stored procedure call" Watch "get latest data from database into GORM after doing insert with stored procedure call" New topic
Author

get latest data from database into GORM after doing insert with stored procedure call

gd dev
Greenhorn

Joined: Mar 11, 2013
Posts: 1



I am working on a grails application where I have to do inserts in 2 tables(has one to many relationships), by calling a stored procedure call from a service. Since Hibernate is not aware of this change, whenever I pull records from the domain(mapped form those 2 tables) instances, using dynamic finder, the newly added rows are not there.

My classes looks similar to these-

class Author {

String name

static hasMany = [books:Book]

static fetchMode = [books:'eager']

}

class Book {

String title

static belongsTo = [author:Author]

}

From my Controller, when I do Author.findAllById(params.id), it does not pull the newly added rows. How can I get the new rows I added by the stored procedure call? Clearing Hibernate second-level-cache/query-cache for domain Author is not an option for me as my domains exist in the 'default package' and therefore SessionFactory cannot reference to the domain.

Any help would be really appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get latest data from database into GORM after doing insert with stored procedure call