Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dali-dev] Migration from Dali 2.0 to 2.1

Hello,

I just moved up to Dali 2.1 from Dali 2.0 and ran into a few API changes that I'm not sure how to fix. I was able to use the wiki page (http://wiki.eclipse.org/Dali_Provisional_API_Changes) to figure most things out, but I have questions on a few others.

1. Currently I am using: JptDbPlugin.instance().getConnectionProfileRepository().connectionProfileNamed(profileName);

This returned a ConnectionProfile object. It looks like I'm supposed to use a ConnectionProfileFactory instead, is the following the best way to do this:

JptDbPlugin.instance().getConnectionProfileFactory().buildConnectionProfile(profileName);


2. Currently I'm doing something like this to get the entity mappings defined in the orm.xml file.
for (Iterator<MappingFileRef> mappingFiles = persistenceUnit.mappingFileRefs(); mappingFiles.hasNext();) {
MappingFileRef mappingFileRef = mappingFiles.next();
OrmXml ormXml = mappingFileRef.getOrmXml();
EntityMappings entityMappings = ormXml.getEntityMappings();
}

The following method no longer exists: mappingFileRef.getOrmXml()

I wasn't able to find any information on this change in the wiki page. Is there a new way I should be handling this situation?


3. I have a bunch of errors around setting and getting Temporal types. It sounds like I need to use these new ConvertibleMapping objects. Currently my code looks like this:

((ColumnMapping)mapping).setTemporal(TemporalType.DATE);

and

TemporalType temporalType = ((ColumnMapping)mapping).getTemporal();

I found a few example in your plugins showing how to get TemporalTypes:

if (this.javaIdMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaIdMapping.getConverter()).getTemporalType();
}

Is this the best way to go about finding the TemporalType? I assume if the mapping has no Temporal_Converter then that means no TemporalType has been set on the mapping?

I wasn't able to find a good example of setting a Temporal type. Would I just add a new TemporalConverter to my mapping and then set the value? I wasn't sure if I could just add a new one because the javadoc in ConvertibleMapping says calling setSpecifiedConverter(String) will remove any old converters. Is it safe to do that?


4. Lastly I had been using a class org.eclipse.jpt.core.context.orm.PersistenceUnitDefaults which no longer seems to exist. I didn't see anything in the API change doc about this. Is there something new I should be using instead?


Thanks for your help,
Chris


Back to the top