Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1946

CDbimport improvements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.M2
    • Non-GUI Tools
    • None

    Description

      We’ve experimented with automated db-first approach to Cayenne modeling for more than a year on a set of client projects. Roughly this approach means that DB evolution is managed via external tools (e.g. liquibase) and Cayenne artifacts are managed using the following POM configuration:

      <plugin>
      <groupId>org.apache.cayenne.plugins</groupId>
      <artifactId>maven-cayenne-plugin</artifactId>
      <configuration>
      ...
      </configuration>
      <executions>
      <execution>
      <id>default-cli</id>
      <goals>
      <goal>cdbimport</goal>
      <goal>cgen</goal>
      </goals>
      </execution>
      </executions>
      </plugin>

      “cdbimport” ensures that Cayenne model is always in sync with DB, “cgen” - that Java classes are in sync with the model. There are zero problems with “cgen", not so with “cdbimport". If you control the schema, you get a decently named Java classes/properties in 95% of the cases. Here we are trying to address the remaining 5% that make things ugly:

      • Inability to generate meaningful relationship names in many cases.
      • Inability to customize attribute/relationship names and data types.

      To solve this here we are proposing a merge algorithm that would preserve customizations to the Obj* layer made by the user. And in addition to that a special descriptor that can be used for more advanced filtering and customization of cdbimport process. Both of these improvements will hopefully result in “cdbimport” becoming a tool of choice for Cayenne work for many users.

      https://docs.google.com/document/d/1DF5-_mMDCuH7iUFhEFDm2q-ebVeSPgvOaymho88ywJ0/edit?pli=1

      Attachments

        Activity

          People

            Unassigned Unassigned
            Alex Kolonitsky Alex Kolonitsky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: