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 8413787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:59:30+00:00 2026-06-10T00:59:30+00:00

My current Spring 3.0 project is integrating with Flyway. Thanks to the google site

  • 0

My current Spring 3.0 project is integrating with Flyway.

Thanks to the google site so there are document I can counting on. But unfortunately there is not much talking about integration with JPA.

So the questions is:

  1. How to integrate Flyway with persistence.xml? And how does it work? Each time JPA provider will auto generate schema update so how we run a script before or after then?

  2. I guess the query by flyway so far does not support HQL and such so is there any sample code then I can go through to know how to integrate the migration event? Design an interceptor or a new aspect?What to do on a domain level?

Any hint is appreciated. Thanks in advance.

  • 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-10T00:59:31+00:00Added an answer on June 10, 2026 at 12:59 am

    Flyway has no support for JPA and Spring. It basically runs your SQL (not HQL) scripts in order and keeps track of them. And does it well. It remains agnostic to how you use your database and how you produce your upgrade scripts.

    However, there’s hope. Your persistence provider will most likely support updating existing schema (I know hibernate and eclipselink can), running ALTER and CREATE statements on startup. The migration SQL scripts aren’t perfect and it won’t always work, but it’s a good start. Log these scripts, collect into SQL file, clean-up and use as V_*.sql file supplied to Flyway.

    UPDATE: although there is no direct support for spring framework, you can easily integrate it with existing Spring application. This approach is proven to work on production and plays nicely:

    <bean id="flyway" class="com.googlecode.flyway.core.Flyway" init-method="migrate">
      <property name="dataSource" ref="..."/>
      ...
    </bean>
    

    Bonus: it works great with Java configuration (with Scala) as well:

    @Bean(initMethod = "migrate")
    def flyway() = {
        val fly = new Flyway()
        fly.setDataSource(dataSource)
        fly
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For our current project, we are integrating JSF and the Spring Framework. I'd like
I use both Spring and Spock plugins in my current project. I wrote a
On my current project we're using Spring 3 MVC and have a requirement to
Our current project does not use Hibernate (for various reasons) and we are using
Is there a specific maven property indicating whether the current project.version is a SNAPSHOT
I've used both spring-batch and drools on previous projects, separately. In my current project,
In my current Spring/JSF project I need integrate a method to push server side
I'm faced with a curious problem in my current project: I've got multiple Spring
In my current project, I want to convert List<String> to RegionLabel Object. For instance,
i keep getting this error, The current value 'String.Empty' type is not compatible with

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.