Questions re eclipselink versions, oracle 12c, xmltype etc [message #1727421] |
Wed, 23 March 2016 00:00 |
Bruce Conrad Messages: 11 Registered: July 2009 |
Junior Member |
|
|
I am in the process of upgrading an application to use Oracle 12c database from 11g running on Weblogic 12.1.1. I need an eclipseLink configuration that will run with both 11g and 12c. I may have found a solution (2.5.2) but I still have a number of questions below.
I had been using eclipseLink version 2.4.1 and Oracle 11g and everything worked fine. When I switched to 12C I got errors regarding XMLType. An example of my java class mapping, using @Customizer with DirectToXMLTypeMapping,is below. This was the major error I saw:
Exception [EclipseLink-3001] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [oracle.xdb.XMLType@22ec201e], of class [class oracle.xdb.XMLType], could not be converted to [interface org.w3c.dom.Document].
Internal Exception: java.lang.ClassCastException: oracle.xdb.XMLType cannot be cast to java.lang.String
I set up libraries on Weblogic for eclipseLink 2.6.2 and 2.5.2. Both fixed the XMLType error. However, with 2.6.2, I saw many other errors. Among them were:
[class java.lang.String], could not be converted to [interface org.w3c.dom.Document].
Internal Exception: java.lang.UnsupportedOperationException: This DocumentBuilder, "oracle.xml.jaxp.JXDocumentBuilder", does not support the reset functionality. Specification "null" version "null"]
Also: org.eclipse.persistence.exceptions.ValidationException.nullPrimaryKeyInUnitOfWorkClone(ValidationException.java:1472)
When I ran test cases from Intellij, I received "shallow clone" errors with both eclipseLink 2.5.2 and 2.6.2. I was able to fix these by setting
<property name="eclipselink.weaving" value="false"/>
from true in my persistence.xml file. I also have weaving set in my spring applicationContext.xml file. I only set eclipselink.weaving=false to get my test cases to run. I did not include the change in my weblogic deployment.
Spring applicationContext.xml configuration file:
<context:load-time-weaver />
<bean id="appManEntityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="cmtDS" />
<property name="persistenceXmlLocation" value="classpath:/META-INF/appmanPersistence.xml" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="showSql" value="false" />
</bean>
</property>
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
</property>
</bean>
So it looks like I can run with eclipseLink 2.5.2 both on Oracle 11g and 12c. However, I would still like to know what is going on. It should be noted that the application is using a very old version of Spring (2.5.6) which could be a factor.
My Questions:
1) Can anyone confirm that eclipseLink 2.5.2 is the way to go?
2) Why did XMLType stop working with Oracle12c and eclipseLink 2.4.1?
3) What is the relationship between eclipselink.weaving property and the Spring load-time-weaver? Do they do the same thing? Does one take precedence? Why does eclipselink.weaving cause my test cases to fail? How come it causes failure when set to true in my test cases but not my weblogic deployment? Do I need both configured?
4) What are the DocumentBuilder errors with eclipseLink 2.6.2 and not the other versions? What changes are needed to upgrade to eclipseLink 2.6.2? I found JXDocumentBuilder in xmlparserv2-11.1.1.0.2.jar. I have this in my pom.xml marked as provided. Is there a newer or different version I should be using?
5) I am using javax.persistence version 2.0.0. Is that the correct version to use with these versions of eclipseLink?
6) While I know I need to upgrade Spring, is this a factor and will it fix some of the other problems, especially the load time weaving?
Mapping for XMLType
@Entity
@Table(name = "CM_EXPERIMENT")
@Customizer(XmlTypeExampleCustomizer.class)
public class XmlTypeExample {
@Id
@Column(name = "CM_EXPERIMENT_ID")
private long id;
private Document document;
}
public class XmlTypeExampleCustomizer implements DescriptorCustomizer {
@Override
public void customize(ClassDescriptor descriptor) throws Exception {
descriptor.removeMappingForAttributeName("document");
DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping();
mapping.setAttributeName("document");
mapping.setFieldName("EXPERIMENT_XML");
mapping.getField().setColumnDefinition("sys.XMLTYPE");
mapping.setIsLazy(true);
mapping.setIsMutable(true);
mapping.setIsReadOnly(false);
descriptor.addMapping(mapping);
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03009 seconds