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

  • SEARCH
  • Home
  • 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 8886481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:34:10+00:00 2026-06-14T21:34:10+00:00

I have this Groovy pseudo-script in a Grails service: sql.eachRow( select id, col1, col2

  • 0

I have this Groovy pseudo-script in a Grails service:

sql.eachRow("""
 select id, col1, col2 
 from mytab
 where col1 is null or col2 is null
"""
){
 ... some code to produce c1, c2 here ...
 sql.execute("""
    update mytab
    set col1 = ${c1}, col2 = ${c2}
    where id = it.id
 """)
}

The problem is that updates are committed to DB only at the end of eachRow loop. I wanted to have updates committed exactly at sql.execute call.

I tried inserting
sql.resultSetConcurrency = GroovyResultSet.CONCUR_UPDATABLE
right before sql.eachRow, but the updates continue to commit only after the end of loop.
Also called an sql.commit() right after sql.execute(), again without success.

The Sql connection comes from a DBCP Tomcat datasource, accessing an Oracle 8.1.7 database.

Thank you!

  • 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-14T21:34:11+00:00Added an answer on June 14, 2026 at 9:34 pm

    Grails service method calls are, per default, automatically wrapped with a transaction. If an unchecked (!) exception is thrown, the db transaction will be rolled back by underlying Spring components. To disable this behaviour, you either have to use @Transactional or specify static transactional = false, as described here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this log4j configuration in my grails config.groovy log4j = { error 'org.codehaus.groovy.grails.web.servlet',
I have this code in a Grails 1.0.4 Groovy console: def devices = Device.getAll()
I have a Groovy/Grails web app that reads e-mails from Gmail. It gets messages
I am using groovy/grails, and I have a ResultList in my service which I
Hi I have this groovy script (in $FRAPID_HOME/bin) and I want to call it
In my Groovy script I have this code: def username = System.getenv()['USER'] def password
I have this domain model, grails-app/domain , named com.portal.Schedule.groovy having this properties: Subject subject
may be too simple groovy question but....please help i have a list like this:
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
I have this VM with tomcat, java, and grails in it. I've been getting

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.