Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] a few more Dali questions (extending entity generation, etc)

Hi Neil,

Appreciate the reply.  Some follow-up below...

Neil Hauge wrote:
>
> Alright...let's tackle these questions!
>
>
> 1) Is there a way when generating entities to tell Dali that I want my
> entity classes added into the class list in the persistence.xml? For
> performance reasons, I want to have all of my classes listed there; also
> for Java SE scenarios this is a necessary requirement.
>
> For M6 we should have a way to perform a user directed syncing of your
> persistence.xml with the Entities in your project. This functionality
> was in 0.5 and we will be bringing it back for 1.0. In addition to this
> functionality, we would like to have a preference driven setting that
> would always keep your persistence.xml in sync with your current
> Entities. For Entity Generation, we could have an option that ensured a
> sync was performed post generation. Enter an enhancement request for
> this if you could and I'm guessing it will make it into 1.0.
>
> 2) I know previously Neil mentioned that in an upcoming release that
> Dali would allow you to have your connection information placed into the
> persistence.xml for you. Will there be some way to decide between a
> datasource or a driver-managed connection? That is, if I have a
> datasource set up, I would just want the jta-data-source written to the
> persistence.xml; otherwise I would need all of the individual provider
> properties written out detailing my connection info. Will these
> scenarios be handled?
>
> Yes, we intend to handle both of these scenarios.

Great, both of these points sound good. Looks like you guys have thought of everything already! :)

>
>
> 3) I'm interested in extending Dali entity generation to handle things
> like generating additional constructors in the entities, or to generate
> some default namedQueries. I believe that I can hook into the Entity
> Generation framework somehow and perhaps provide my own subclassed
> Entity Generator. Is this currently possible? It would be nice to be
> able to specify my EntityGenerator in a plugin and then perhaps be able
> to choose that from a list of generator providers (or set it up
> programatically beforehand) and have the entity generation wizard call
> by EntityGenerator. Is something like this currently possible?
>
> What you describe isn't currently possible. We need to come up with
> general concept for how we expect extenders to enhance/replace entity
> generation inside the general Dali framework. It is possible that this
> could be set up as an independent extension point, or something that is
> tied into the Platform concept. I suggest opening an enhancement request
> and putting your thoughts on the matter into the ER. Other extenders
> also have thoughts on this, so we can evaluate the options and determine
> what is feasible for the 1.0 release in this area.

Okay, I definitely think this is important to allow nice extension, rather than having a bunch of people subclassing the existing Dali wizards and creating horrible abominations that are tightly coupled and prone to breakage. A simple scenario - from my tooling, I always want Entities generated with some default namedQueries. It'd be nice if I could easily do this without having to rewrite a bunch of Dali code, and just hook in my entity-generation code somehow.


>
> 4) Along these same lines, if I want to update the model before
> generation to add things like setting up an OCC column or additional
> relationships, can I do so? That is, is this entity model exposed so I
> can update it so that it will generate what I want?
>
> It seems that you are referring to the DB model that we are using as the
> basis for our Entity Generation. The DB model that we generate from is
> the actual Database Definition Model defined by the DTP Model Base. It
> is probably possible to modify this model pre-gen, which would affect
> the Entities that are generated. In the case of Entity Generation, there
> is no relavent entity model to alter before generation. More details on
> what you are trying to do here might help me understand what you are
> asking about

Yeah, what I wrote was probably confusing. What I was asking was what to do if I want to specify that my Entity uses concurrency detection by specifying a column to have the @version tag. I was wondering if there was an EntityGeneration Model where I could get the various fields that will be generated and say that I want this one to be specified as the Concurrency (@version) column. Similarly if I wanted to setup automatic primary key generation; I would like to be able to somehow specify this (probably in my own custom EntityGenerator) so that the correct annotations would be generated. This is sort of an example of how I might want to extend the Dali wizards.

Thanks,
Tom

>
> Hope this helps,
> Neil


Back to the top