Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dali-dev] Dali comments regarding generated artifacts/wizards

Hi all,

I've been using Dali for a while and I think it is very nice. I have a few questions that I thought someone might be able to answer or comment on as I'm looking to write some tooling around generated entities. Keep in mind that I'm currently using Dali 0.5 since the 2.0 milestones did not yet have the ability to add persistence to the project. So if some of these things have already been added to the latest codebase (and I'm sure many have), I apologize in advance. :)

*  The Add Persistence dialog
1) Schemas - Setting the schema here currently does not seem to have a lot of impact. It looks like it is used primarily as the default for when later generating entities, and for validating the generated entities. Generating entities from multiple schemas or connections does not seem to be supported here. Could there be an option for the selected schema to be written out to the orm.xml as the default schema for that persistence unit? <persistence-unit-defaults>
          <schema>ADMINISTRATOR</schema>
   </persistence-unit-defaults>
This is a requirement when using DB2 for instance, and it might be nice to be able to assist the user here. 2) Multiple persistence units. Could the Add Persistence be used more as a Add Persistence Unit dialog that could be launched at any time? This way, a user could add multiple persistence units to handle entities that from multiple connections or schemas. And as mentioned above, it might be nice to be able to specify that for a particular persistence unit, you want the schema name generated into a mappings.xml file (and reference that from the persistence.xml) or instead that you want your entities generated with a schema tag on the @table annotation.

3) Connection info. Since the connection information is collected here, it might be nice if the connection info could be generated into the persistence.xml for the user. Perhaps you could be prompted to specify a datasource name, or to instead have the connection information generated directly into the persistence.xml (for non-datasource, driver-managed connections). 4) Persistence providers. Could the persistence provider be made a dropdown with a list of common persistence providers (and perhaps made to be able to programatically add new providers)? This would make it much easier to select a provider and have it generated into your persistence.xml.


* The Generate Entities dialog
1) Schema/Connection. It might make sense to be able to select the Connection and Schema at this time as well. It could of course default to the connection/schema initially selected, but seems restrictive to only allow show entities from the originally chosen connection/schema. Or perhaps you could select which existing persistence unit you want to generate entities from.



* Entity generation customization.
It is easy enough to tailor your entities after they have been generated using the annotation property pages, but I think that there could still be some useful options that can be set up front in the wizard. 1) Columns. It could be helpful to see the Database columns from the table you have selected. Perhaps you do not want fields/accessors generated for all columns (as your application does not require them). 2) Primary Key. It might be nice to be able to specify a column to use for a primary key in the case where one is not explicitly specified in the database table. Or to be able to choose multiple columns for a compound key. Also, you could select the column to be used for Auto Key Generation.

3) Optimistic Concurrency. You could select a concurrency column (generated with an @version annotation).

4) Relationships. It would be nice to see relationships for a selected table, as well as the ability to add additional relationships to other tables (that are specified in the database via foreign keys)

5) Additional constructors. In addition to the default constructors, it might be nice to be able to generate a constructor that takes in the primary key values since they always need set anyway. Or constructor that takes in all values for required non-null values.


And that's about it! :) If some of these things have already been implemented or are in the plans (or there are no plans), please let me know. Or if the right way to do something is to handle it myself programatically (by extending EntityGenerators, etc) that would be appreciated too. Thanks for any information that can be provided.
Tom





Back to the top