Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:22:59+00:00 2026-06-15T21:22:59+00:00

I am running grails 1.3.7 and using the grails database migration plugin version database-migration-1.0

  • 0

I am running grails 1.3.7 and using the grails database migration plugin version database-migration-1.0

The problem I have is I have a migration change set. That is pulling blobs out of a table and writing them to disk. When running through this migration though I am running out of heap space. I was thinking I would need to flush and clear the session to free up some space however I am having difficulty getting access to the session from within the migration. BTW The reason it’s in a migration is we are moving away from storing files in oracle and putting them on disk

I have tried

SessionFactoryUtils.getSession(sessionFactory, true)

I have also tried

SecurityRequestHolder.request.getSession(false)   //request in null -> not surprising

changeSet(author: "userone", id: "saveFilesToDisk-1") {
    grailsChange{
        change{
            def fileIds = sql.rows("""SELECT id FROM erp_file""")
            for (row in fileIds) {
                def erpFile = ErpFile.get(row.id)
                erpFile.writeToDisk()
                session.flush()
                session.clear()
                propertyInstanceMap.get().clear()
            }
            ConfigurationHolder.config.erp.ErpFile.persistenceMode = previousMode
        }
    }
}

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:23:01+00:00Added an answer on June 15, 2026 at 9:23 pm

    The application context will be automatically available in your migration as ctx. You can get the session like this:

    def session = ctx.sessionFactory.currentSession
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have issues running grails using grails > run-app If I change a controller
I am using Grails 2.1.0 and lesscss-resources 1.3.0.3 I have created a plugin containing
I am using Grails 1.3.7 and cannot figure out how to get version 4.0
I am learning Grails using version 1.3.7 and I keep running into the following
I am running grails plugin for Spring Social from https://github.com/synergyj/grails-spring-social-core When I tried to
Currently I am facing issues, that the java melody statistics running for a grails
I got Grails CMS (Weceem) up and running. Through the admin screen I have
I have a Grails web application running on a german localized machine. How does
I have been attempting to learn Grails, however I am running into the following
We're running into transaction issue with Grails. During performance test we have a scenario,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.