Grails
  1. Grails
  2. GRAILS-7384

issue related to <g:select> & hibernate; trying to change a value from a dropdown list (similar to issue GRAILS-6388)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.3.7
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 10.10 (or windows 7), java-6-sun-1.6.0.24 (or lower) STS 2.6.0 (or lower)

      Description

      I created a Grails application based on an existing Oracle database.
      The definition of all my domain classes (primary keys, field names) is mapped to reflect the exisiting database.
      Basically I am not starting by designing myself new domain classes, they all already are predefined.

      My project is open source and available at:
      code.google.com/p/ezmanager

      My context is the following:

      I have a project domain classe (http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/domain/ezmanager/domain/Project.groovy) which has a status field (http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/domain/ezmanager/domain/BaseStatus.groovy).

      When I try to change the status of an existing project (http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/views/baseStatus/edit.gsp)

      I get the following exception:

      Error 500: Executing action [update] of controller [ezmanager.controllers.ProjectController] caused exception: identifier of an instance of ezmanager.domain.BaseStatus was altered from 1 to 5; nested exception is org.hibernate.HibernateException: identifier of an instance of ezmanager.domain.BaseStatus was altered from 1 to 5
      Servlet: grails
      URI: /ezmanager/grails/project/update.dispatch
      Exception Message: identifier of an instance of ezmanager.domain.BaseStatus was altered from 1 to 5
      Caused by: identifier of an instance of ezmanager.domain.BaseStatus was altered from 1 to 5
      Class: ProjectController

      I think this issue is very similar to the GRAILS-6388 (http://jira.codehaus.org/browse/GRAILS-6388)

      For your information, in the book Groovy in action (chapter 16: Seeing the Grails light), there is a kind of comparable exemple based on 2 classes TutorialEntry and Author; By analogy Project is equivalent to TutorialEntry and Status (BaseStatus) is equivalent to Author.
      If I follow step by step the instructions (classe definition, generation of controllers and views), then I can without any difficulty change the Author of an TutorialEntry. It is working well because the database is designed by the developper. In my case, the database tables and table attributes have been imposed to the user.

      Can you please help me to fix my issue?

      Should I wait for the Grails Release 1.4M1?

      Best Regards
      Michel

        Activity

        Hide
        Michel Petrovic added a comment -
        Show
        Michel Petrovic added a comment - The PL/SQL script for creating the Oracle database is located at: http://code.google.com/p/ezmanager/source/browse/trunk/database/database.infrastructure/database.scripts/ezManager.scripts.sql
        Hide
        Michel Petrovic added a comment -

        In fact the controller which is in charge of changing the status of the project is:

        http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/controllers/ezmanager/controllers/ProjectController.groovy

        In the original description of the issue I pointed to a wrong controller. Sorry for that.

        Show
        Michel Petrovic added a comment - In fact the controller which is in charge of changing the status of the project is: http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/controllers/ezmanager/controllers/ProjectController.groovy In the original description of the issue I pointed to a wrong controller. Sorry for that.
        Show
        Michel Petrovic added a comment - My domain and controller classes have changed they are all located in the package ezmanager. http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/domain/ezmanager/BaseStatus.groovy http://code.google.com/p/ezmanager/source/browse/trunk/project/ezmanager.grail_tomcat/grails-app/controllers/ezmanager/ProjectController.groovy
        Hide
        leonardo added a comment -

        This is quite critical and also happens in Grails 2.0. I think it should be fixed quickly...

        Show
        leonardo added a comment - This is quite critical and also happens in Grails 2.0. I think it should be fixed quickly...
        Hide
        Jeff Scott Brown added a comment -

        Is this still an issue with 2.3.0 and if so can someone attach a simple 2.3.0 app which contains just enough code to reproduce the problem?

        Show
        Jeff Scott Brown added a comment - Is this still an issue with 2.3.0 and if so can someone attach a simple 2.3.0 app which contains just enough code to reproduce the problem?

          People

          • Assignee:
            Unassigned
            Reporter:
            Michel Petrovic
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development