[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [dali-dev] Listening for Entity Generation operations
|
Hi Tom,
It seems that what you (and probably Chris as well) really want to do is
to run the wizard and the entity generation operation yourself. In the
generic platform we call
org.eclipse.jpt.ui.internal.generic.EntitiesGenerator.generate(IJpaProject,
IStructuredSelection). In here we run the GenerateEntitiesWizard and
then schedule the WorkspaceJob that generates the entities and
synchronizes the persistence.xml classes. You should probably be using
PackageGenerator.generateEntities() which takes an IProgressMonitor. I
would assume that you would copy a lot of the code in EntitiesGenerator
and change how the Job is run. Then you would be able to hook in at the
right moment to do your post-processing, probably before the
persistence.xml SynchronizeClassesJob is run. Look at the code in
EntitiesGenerator.GenerateEntitiesRunnable.runInWorkspace(IProgressMonitor).
I would expect your code to come after the call to
PackageGenerator.generatesEntities().
The most likely candidate for public API here is
PackageGenerator.generateEntities(Config, EntityGenerator.Config,
Collection<Table>, OverwriteConfirmer, IProgressMonitor). Does this
sound reasonable?
Karen
Tom Mutdosch wrote:
Hi Karen,
Is the entire Entity Generation wizard run in a WorkspaceJob, or just
the EntityGeneration operition? Basically we want to run the
EntityGeneration wizard and operation atomically. Is this how it
works currently? So if we launch the Dali wizard; when would we
launch our Job (which would essentially be emulating a join()..)? Are
we able to do this in a postOperation after the EntityGeneration
operation runs? Using a Job in this fashion seems a bit hacky; is
there some way we could instead pass our own ProgressMonitor to the
operation or something along those lines instead?
I'm wondering if always running the Entity Generation in the
background could be problematic. It is probably fine in the current
use-case scenarios, but could fail in cases like ours where we need to
generate an entity before proceeding, or maybe you wanted to perform
refactoring to make a composite key out of an entity (which would
create the separate EmbeddableID class, which you would probably want
to show in the model immediately). Could there be some way to
programatically set a switch to have the operation run in the
background or foreground? This seems to be a common pattern for these
types of generation.
Thanks
Tom
------------------------------
Message: 2
Date: Tue, 04 Sep 2007 10:30:48 -0400
From: Karen Moore <karen.moore@xxxxxxxxxx>
Subject: Re: [dali-dev] Listening for Entity Generation operations
To: "General Dali EJB ORM developer discussion."
<dali-dev@xxxxxxxxxxx>
Message-ID: <46DD6C18.1080901@xxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi Chris,
We changed entity generation to use a WorkspaceJob instead of a
IWorkspaceRunnable so that we could make it run in the background
instead of locking up the UI. The Job has the IProject as a scheduling
rule since anything in the project can change. You could set up a Job
as well for the population of your table that also has a scheduling rule
of IProject. Then your Job will not run until our entity generation Job
has completed. Hope this helps.
Karen
Christopher Jaun wrote:
Hello,
Is there a way I can listen for newly generated entities?
I see as a result of this change
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=181816) in the
maintenance stream that entities are now generated in the background
when created with your wizard.
I have a wizard containing a button that allows a user to launch your
entity wizard and when that returns I populate a table with the newly
created entities. Now that these are being generated in the background
I need a way to know when all the entity generation operations are
complete or at least be notified every time a new entity is created so
I can add it to my table.
Is there a way to do this?
Thanks,
Chris
------------------------------------------------------------------------
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev
------------------------------
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev
End of dali-dev Digest, Vol 24, Issue 1
***************************************
------------------------------------------------------------------------
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev