Uploaded image for project: 'Hibernate ODM'
  1. Hibernate ODM
  2. HIBERNATE-38

Design, implement and document how an application can configure the product

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Judging from https://github.com/mongodb/mongo-hibernate/pull/8, we seem to want to require the MongoDB connection string to be specified via the JdbcSettings.JAKARTA_JDBC_URL property. We also want to allow for programmatic configuration via MongoClientSettings: https://jira.mongodb.org/browse/HIBERNATE-28. This means, we are talking about three different approaches that conflict with each other:

      • MongoDB connection string
      • MongoClientSettings
      • Hibernate ORM settings/properties1

      Following are some obvious conflict examples (that is, not an exhaustive list):

      • ConnectionString.getHosts conflicts with ClusterSettings.Builder.hosts
      • ConnectionString.getDatabase conflicts with MappingSettings.DEFAULT_CATALOG, MappingSettings. DEFAULT_SCHEMA
      • ConnectionString.getCredential conflicts with JdbcSettings.JAKARTA_JDBC_USER, JdbcSettings.JAKARTA_JDBC_PASSWORD, MongoClientSettings.Builder.credential.

      We have to develop a clear approach on how to deal with those conflicts, which may include forbidding some of the ways to configure the product; implement that approach and document it. One of the approaches may be:

      1. MongoClientSettings customization that will be introduced by https://jira.mongodb.org/browse/HIBERNATE-28 overrides ConnectionString.
      2. ConnectionString must be specified via JdbcSettings.JAKARTA_JDBC_URL.
      3. Any Hibernate ORM configuration property (see AvailableSettings for the complete list) whose value may be specified via either ConnectionString or MongoClientSettings is explicitly forbidden (it's an error if an application specifies its value).
      4. Any Hibernate ORM configuration property that our product uses either directly or indirectly, whose value cannot possibly be specified via either ConnectionString or MongoClientSettings, is allowed (an application may specify it, and expect our product to behave accordingly).
      5. Any other Hibernate ORM configuration property is explicitly forbidden (it's an error if an application specifies its value).

      The configuration-related documentation introduced on MongoConnectionProvider in https://github.com/mongodb/mongo-hibernate/pull/8 is nothing but a draft that was not thought out. Updating it is in scope of this task.

      Note:


      1 Hibernate ORM documentation uses "settings" and "properties" these terms interchangeably, which is nothing but a sloppy job.

      See also https://github.com/mongodb/mongo-hibernate/pull/8#discussion_r1840934095, https://github.com/mongodb/mongo-hibernate/pull/18#discussion_r1912603079.

      Addressing the source code notes tagged with TODO-HIBERNATE-38 is in scope of this ticket.

            Assignee:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Reporter:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: