#198 ✓resolved
Erwan Loisant

jpa.ddl defaults to update though commented out

Reported by Erwan Loisant | October 5th, 2010 @ 11:59 AM | in 1.1

Even though the jpa.ddl setting is commented out in application.conf to begin with - it defaults to update. Anyone unsuspecting and using an existing database to test against ( i.e. to prototype a new Play app against an existing db and schema ) can have their tables modified unwanted and unaware. Would suggest to default to jpa.ddl=none and force users to uncomment the entry to have ddl updates maintained. Perhaps also, a production check to ensure a move to prod forces a user to manually make an additional or prod specific change and help prevent any accidental ddl changes to the db.

Imported from Launchpad: https://bugs.launchpad.net/play/+bug/544536

Comments and changes to this ticket

  • Venki Ramachandran

    Venki Ramachandran November 1st, 2011 @ 08:03 AM

    Hi all:
    I downloaded and installed the latest 1.2.3 and set the jpa.ddl = create and ran. It created the schema and loaded data. Then when I updated it to 'none', it is trying to delete or update and giving a lot of errors. Below is from my application.conf file:
    -------Start Snip ------------------------------- #

    Specify the ddl generation pattern to use. Set to none to disable it

    (default to update in DEV mode, and none in PROD mode):

    %devtest.jpa.ddl=none %prod.jpa.ddl=none

    Debug SQL statements (logged using DEBUG level):

    -------End Snip -------------------------------

    The second time run of play is below:

    ------------------Start of second Snip ----------------------------------------------------------------------------

    [venkir:/Users/venkir/verdeeco/workspace/dev/core]->play run --%devtest ~ _ _ ~ _ | | _ _ | | ~ | ' \| |/ ' | || || ~ | /||_|_ () ~ |_| |__/
    ~ ~ play! 1.2.x-localbuild, http://www.playframework.org ~ framework ID is devtest ~ ~ Ctrl+C to stop ~ Listening for transport dt_socket at address: 8000
    13:10:29,017 INFO ~ Starting /Users/venkir/verdeeco/workspace/dev/core
    13:10:29,022 WARN ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.spring)
    13:10:29,023 INFO ~ Module spring is available (/usr/local/play-1.2.3/modules/spring-1.0.2)
    13:10:29,908 WARN ~ You're running Play! in DEV mode
    13:10:30,053 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
    13:10:56,657 INFO ~ Connected to jdbc:postgresql:coredb
    13:10:58,077 INFO ~ Application 'Core' is now started !
    13:10:58,155 INFO ~ App Mode is dev
    13:10:58,155 INFO ~ Recreating Models in dev
    13:10:58,411 WARN ~ SQL Error: 0, SQLState: 23503
    13:10:58,411 ERROR ~ ERROR: update or delete on table "meter" violates foreign key constraint "fk3979db5c4b9c8d1" on table "intervalconsumptionqualityflag"
    Detail: Key (id)=(3) is still referenced from table "intervalconsumptionqualityflag". 13:10:58,413 ERROR ~ While deleting class models.meter.Meter instances
    javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute update query

        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214)
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147)
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1224)
        at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108)
        at play.db.jpa.JPAPlugin$JPAModelLoader.deleteAll(JPAPlugin.java:478)
        at play.test.Fixtures.delete(Fixtures.java:72)
        at play.test.Fixtures.delete(Fixtures.java:92)
        at play.test.Fixtures.deleteAllModels(Fixtures.java:104)
        at jobs.Bootstrap.doJob(Bootstrap.java:33)
        at play.jobs.Job.doJobWithResult(Job.java:50)
        at play.jobs.Job.call(Job.java:146)
        at Invocation.Job(Play!)

    Caused by: org.hibernate.exception.ConstraintViolationException: could not execute update query

        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)

    ------------------End of second Snip ----------------------------------------------------------------------------

    HELP!!, How do I make play not control the schema, both creation and loading of test data.

    Thanks, Venki

  • Venki Ramachandran

    Venki Ramachandran November 1st, 2011 @ 09:10 AM

    jpa.ddl = none and update does not work, gives DB errors. only create works and it recreates the entire tables and data...not what I want.

  • Samsun Rock

    Samsun Rock April 9th, 2019 @ 05:20 AM

    Thank you for the update this project. a surly create a user name after using my recommendation, its very effective from understanding about how do i change in username windows 10 computer in perfectly. anyone can get a free chance from improve our knowledge in this service.

  • JamesMorris

    JamesMorris May 18th, 2019 @ 04:53 PM

    You are also welcome to be aware of the high-quality information at https://gust.com/companies/casino-hex-japan because I'm sure it can help a lot of the gambling players to understand what the main difficulty is.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2>Play framework</h2>

Play makes it easier to build Web applications with Java. It is a clean alternative to bloated Enterprise Java stacks. It focuses on developer productivity and targets RESTful architectures. Learn more on the <a href="http://www.playframework.org">http://www.playframework.org</a> website.<br><br>

<h2>Source code is hosted on github</h2>Check out our repository at <a href="http://github.com/playframework/play">http://github.com/playframework/play</a><br><br>

<h2>Contributing, creating a patch</h2> Please read the <a href="http://play.lighthouseapp.com/projects/57987/contributor-guide">contributor guide</a><br><br>

<h2>Reporting Security Vulnerabilities</h2> Since all bug reports are public, please report any security vulnerability directly to <em>guillaume dot bort at gmail dot com</em>.<br><br>

<h2>Creating a bug report</h2> Bug reports are incredibly helpful, so take time to report bugs and request features in our ticket tracker. We’re always grateful for patches to Play’s code. Indeed, bug reports with attached patches will get fixed far quickly than those without any.<br><br>

Please include as much relevant information as possible including the exact framework version you're using and a code snippet that reproduces the problem.<br><br>

Don't have too much expectations. Unless the bug is really a serious "everything is broken" thing, you're creating a ticket to start a discussion. Having a patch (or a branch on Github we can pull from) is better, but then again we'll only pull high quality branches that make sense to be in the core of Play.

People watching this ticket