Skip to main content

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

Thanks for your feedback Tom.  Here are some responses for you:

Project/Persistence Unit creation
1) The request for a schema to be written out to the orm.xml as the default for the persistent unit sounds like a good idea. Please enter an enhancement request for this feature in bugzilla if you could. - https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Dali%20JPA%20Tools

2) Unfortunately Dali 1.0 will likely not explicitly support multiple persistence units per project. There is a lot of complexity that is introduced with multiple persistence units in a single project having to do with validation and defaulting, among other things. As of now, our 1.0 version will support one persistence.xml per project and one persistence unit per persistence.xml.

3)  This functionality is in the plan for 1.0.

4) Dali 1.0 will have a "Platform" concept that will deal with this and many other issues regarding vendor specific functionality

Generate Entities
1) This is in the plan for Dali 1.0 as well, but you may want to add an enhancement request to express adopter interest in this. Without support for multiple persistence units, this may not make as much sense, but still may be a reasonable thing to do.

Entity Generation Customization
For these items, I think there are a couple of different ways they could be handled. Ideally, enhancement requests would be filed for these items and the Dali team would evaluate whether or not a given request is suitable for the base code, or whether this is something better left to an extender's code base. If it is a good fit for Dali, a code patch for the functionality would be submitted to the ER and then evaluated for inclusion in the base.
Hope this helps,

Neil


Tom Mutdosch wrote:

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



_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev



Back to the top