Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Help with Porting over to Indigo
Help with Porting over to Indigo [message #764768] Mon, 12 December 2011 15:15 Go to next message
Kenneth Cheung is currently offline Kenneth Cheung
Messages: 9
Registered: July 2009
Junior Member
Hi,

We are porting our code to Indigo and found some API changes. We try to come up with a list of mappings between the old and new APIs to the best of our abilities. Is anyone able to verify and complete the list? Thanks!

org.eclipse.jpt.core.context.java.JavaManyToManyRelationshipReference
->
org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship

org.eclipse.jpt.core.context.orm.OrmPersistentAttribute.makeSpecified(String mappingKey)
-> org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute.convertToSpecified(String mappingKey)

org.eclipse.jpt.core.context.PersistentAttribute.setSpecifiedMappingKey(String key) ->
org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute.setMappingKey(String key)

org.eclipse.jpt.jpa.core.context.Converter.TEMPORAL_CONVERTER
->
org.eclipse.jpt.jpa.core.context.TemporalConverter.class

org.eclipse.jpt.jpa.core.context.ConvertibleMapping.setConverter(Converter.TEMPORAL_CONVERTER)
->
org.eclipse.jpt.jpa.core.context.ConvertibleMapping.setConverter(TemporalConverter.class)

org.eclipse.jpt.core.context.orm.OrmXml.getEntityMappings()
->
org.eclipse.jpt.jpa.core.context.orm.OrmXml.getEntityMappings().getRoot()

org.eclipse.jpt.core.context.PersistentAttribute.getSpecifiedMapping()
->
org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute.getMapping()

org.eclipse.jpt.core.context.PersistentType.getShortName()
->
org.eclipse.jpt.jpa.core.context.PersistentType.getSimpleName()

org.eclipse.jpt.core.JpaProject.Updater->??

org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater->??
Re: Help with Porting over to Indigo [message #766473 is a reply to message #764768] Thu, 15 December 2011 16:10 Go to previous messageGo to next message
Brian Vosburgh is currently offline Brian Vosburgh
Messages: 132
Registered: July 2009
Senior Member
Kenneth Cheung wrote on Mon, 12 December 2011 15:15

org.eclipse.jpt.core.JpaProject.Updater->??

org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater->??


Your list looks reasonably accurate. To fill in your missing entries:

JpaProject.Updater -> org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer

SynchronousJpaProjectUpdater -> org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer

Also, I have to warn you that these two classes are set to change yet again in Juno. :-) The API for making "large" changes to a Dali JpaProject should be much simpler with the next milestone. At least that's the hope.

Brian
Re: Help with Porting over to Indigo [message #766478 is a reply to message #764768] Thu, 15 December 2011 16:31 Go to previous messageGo to next message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Just a few more comments.

Quote:
org.eclipse.jpt.core.context.orm.OrmXml.getEntityMappings()
->
org.eclipse.jpt.jpa.core.context.orm.OrmXml.getEntityMappings().getRoot()

The new api is just OrmXml.getRoot(), I'm guessing this was just a typo

Quote:
org.eclipse.jpt.core.context.PersistentAttribute.getSpecifiedMapping()
->
org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute.getMapping()

This API is somewhat different since the new API would never return null. You can ask the returned AttributeMapping if it isDefault() (vs. specified). The getSpecifiedMapping() api has been removed.

Karen
Re: Help with Porting over to Indigo [message #768812 is a reply to message #766478] Tue, 20 December 2011 16:13 Go to previous messageGo to next message
Kenneth Cheung is currently offline Kenneth Cheung
Messages: 9
Registered: July 2009
Junior Member
Thanks all!

Also does it still apply?

Changing the Context model programatically
If you are changing the model outside the UI thread you will need to configure the JPA project to make modifications on the UI thread as necessary. See JpaProject#setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor).

Also note the model is "updated" asynchronously with every change. If you want these updates to happen synchronously, you will need to set the JPA project's "updater". See JpaProject#setUpdater(Updater). Note the comments in SynchronousJpaProjectUpdater.


If so what is the new way of doing it?
Re: Help with Porting over to Indigo [message #772004 is a reply to message #768812] Wed, 28 December 2011 14:18 Go to previous messageGo to next message
Brian Vosburgh is currently offline Brian Vosburgh
Messages: 132
Registered: July 2009
Senior Member
Quote:
Also does it still apply?

Yes.
Quote:
If so what is the new way of doing it?

It's a bit more painful with Indigo. (It will be much better with Juno.) You need to set a couple of synchronizers on the JpaProject. This example code is lifted from the Dali test harness (org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject):
this.jpaProject.setContextModelSynchronizer(this.buildSynchronousCMS());
this.jpaProject.setUpdateSynchronizer(this.buildSynchronousUS());

protected Synchronizer buildSynchronousCMS() {
	return new SynchronousSynchronizer(this.buildSynchronousCMSCommand());
}

protected Command buildSynchronousCMSCommand() {
	return new SynchronousContextModelSynchronizerCommand();
}

protected class SynchronousContextModelSynchronizerCommand implements Command {
	public void execute() {
		TestJpaProject.this.jpaProject.synchronizeContextModel(new NullProgressMonitor());
	}
}

protected CallbackSynchronizer buildSynchronousUS() {
	return new CallbackSynchronousSynchronizer(this.buildSynchronousUSCommand());
}

protected Command buildSynchronousUSCommand() {
	return new SynchronousUpdateSynchronizerCommand();
}

protected class SynchronousUpdateSynchronizerCommand implements Command {
	public void execute() {
		TestJpaProject.this.jpaProject.update(new NullProgressMonitor());
	}
}
Re: Help with Porting over to Indigo [message #778504 is a reply to message #772004] Thu, 12 January 2012 17:30 Go to previous message
Kenneth Cheung is currently offline Kenneth Cheung
Messages: 9
Registered: July 2009
Junior Member
Thanks I'd never have figured it out myself.
Previous Topic:Generated classes recreated after delete
Next Topic:New JPA Project Wizard Platform filtering possible?
Goto Forum:
  


Current Time: Thu Aug 21 02:20:31 EDT 2014

Powered by FUDForum. Page generated in 0.01755 seconds