Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Questions re eclipselink versions, oracle 12c, xmltype etc(Questions re eclipselink versions, oracle 12c, xmltype etc)
Questions re eclipselink versions, oracle 12c, xmltype etc [message #1727421] Wed, 23 March 2016 00:00 Go to next message
Bruce Conrad is currently offline Bruce ConradFriend
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);
   }
}
Re: Questions re eclipselink versions, oracle 12c, xmltype etc [message #1727422 is a reply to message #1727421] Wed, 23 March 2016 00:09 Go to previous messageGo to next message
Lukas JungmannFriend
Messages: 34
Registered: November 2013
Location: Prague, Czech Republic
Member
to give you at least some answers:

1) 2.6.2 will be better choice as there were some Oracle DB 12c specific fixes
4) see https://bugs.eclipse.org/bugs/show_bug.cgi?id=490229
5) use javax.persistence version 2.1 (even though 2.0 is supported as well)

for 2, 3 and 6 I don't have immediate answers
Re: Questions re eclipselink versions, oracle 12c, xmltype etc [message #1727548 is a reply to message #1727422] Wed, 23 March 2016 17:05 Go to previous message
Bruce Conrad is currently offline Bruce ConradFriend
Messages: 11
Registered: July 2009
Junior Member
Thanks for the response. Yes, I had started with version 2.6.2 but ran into problems. It wasn't till I set eclipselink.weaving to false that I got to a manageable number of errors, mostly focusing on the xmlparserv2 issue. I see you opened an issue for this. Until I see a solution I'll stay at 2.5.2.

I still would like to hear back on the other questions especially #3 "the relationship between eclipselink.weaving property and the Spring load-time-weaver". Also, #2, why did XMType stop working with Oracle 12C and eclipseLink 2.4.1.

Previous Topic:How to dynamically specify/allocate the name of a sequence ?
Next Topic: persistence.xml eclipse link
Goto Forum:
  


Current Time: Fri Mar 05 16:35:08 GMT 2021

Powered by FUDForum. Page generated in 0.01392 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top