Grails
  1. Grails
  2. GRAILS-6136

Remove unrelated properties of datasource

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Configuration
    • Labels:
      None

      Description

      Here is a typical DataSource.groovy:

      dataSource {
         pooled = true
         driverClassName = "com.mysql.jdbc.Driver"
         username = "xxx_user"
         password = "123456"
         dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
         loggingSql = false
      }
      hibernate {
         cache.use_second_level_cache=false
         cache.use_query_cache=false
         cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
      }
      // environment specific settings
      environments {
         development {
            dataSource {
               dbCreate = "create-drop" // one of 'create', 'create-drop','update'
               url = "jdbc:mysql://localhost/xxx_dev?useUnicode=true&characterEncoding=utf8"
            }
         }
         test {
            dataSource {
               dbCreate = "update"
               url = "jdbc:mysql://localhost/xxx_test?useUnicode=true&characterEncoding=utf8"
            }
         }
         production {
            dataSource {
               dbCreate = "update"
               jndiName = "java:comp/env/jdbc/xxx"
            }
         }
      }
      

      As you can see the property 'dialect', 'dbCreate' and 'loggingSql' are Hibernate related properties, but they are belonged to the 'dataSource' block, which is confusing. Those properties should belong to the 'hibernate' block. I know this is a breaking change. It would be great if you can move those properties to 'hibernate' block, and deprecated those properties in the 'dataSource' (by giving warnings when the application is starting up)

        Activity

        Hide
        Burt Beckwith added a comment -

        Some are a bit counterintuitive, but it has been like this for a long time and would be a significant breaking change and would make upgrading harder

        Show
        Burt Beckwith added a comment - Some are a bit counterintuitive, but it has been like this for a long time and would be a significant breaking change and would make upgrading harder

          People

          • Assignee:
            Unassigned
            Reporter:
            Tinh Truong Xuan
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development