Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313545

Summary: Eclipselink is losing some data for certain types of data structures when unmarshalling xml to java objects
Product: z_Archived Reporter: Raj <raj.eclipselink>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: blaise.doughan, matt.macivor
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Sessions.xml file none

Description Raj CLA 2010-05-19 11:01:39 EDT
Build Identifier: eclipselink-2.0.2.v20100323-r6872

For an xml structure like this, when i declare the schema context of the object EMPLRecords as EMPL_Records and subsequently map the child element EMPL_FIRST_NAME to an attribute of EMPLRecords object by defining the xpath as EMPL_INFO/EMPL_FIRST_NAME/text(), the values are not set when the xml was unmarshalled to the java object.

This used to work in version 1.1.4.  

<EMPL_RECORDS>
	<EMPL_NUM>123456</EMPL_NUM>
	<EMPLINFO>
		<EMPL_FIRST_NAME>XYZ</EMPL_FIRST_NAME>
		<EMPL_LAST_NAME>ABC</EMPL_LAST_NAME>
	</EMPLINFO>
</EMPL_RECORDS>

Reproducible: Always

Steps to Reproduce:
1.Use an xsd to map EMPLRecords object in the workbench
2.set the jaxb.properties context to javax.xml.bind.context.factory = org.eclipse.persistence.jaxb.JAXBContextFactory
3.Try to unmarshall the XML file to EMPLRecords object. The first name and last name properties are not populated with values.
Comment 1 Matt MacIvor CLA 2010-05-19 14:43:14 EDT
Please provide the Schema and EMPLRecords class for debugging.

Additional Information would be helpful:

-Which API are you using to create your context
-Which API is being called to Unmarshal the XML
-Is there a sessions.xml file on your classpath? If so, please provide this sessions.xml
-Was project deployment xml generated from the mapping workbench? If so, please provide this project.xml
-Are any error messages or warning logged to the console during context creation?

Also in your description, you say that the mapped XPATH is EMPL_INFO/EMPL_FIRST_NAME/text() however in the provided instance doc EMPLINFO doesn't contain an underscore. Double check your xpaths vs your instance doc to make sure that this is correct.
Comment 2 Raj CLA 2010-05-19 16:04:06 EDT
Matt
  thanks for the prompt reply. That was just an example I provided to illustrate the issue. The EMPL_INFO was a typo. I will update you with all all the information soon.

The actual schema structure and the class files that I am dealing with is huge. I will try to provide a test that fails and will provide you with the results as soon as possible.

Thanks
Raj


(In reply to comment #1)
> Please provide the Schema and EMPLRecords class for debugging.
> 
> Additional Information would be helpful:
> 
> -Which API are you using to create your context
> -Which API is being called to Unmarshal the XML
> -Is there a sessions.xml file on your classpath? If so, please provide this
> sessions.xml
> -Was project deployment xml generated from the mapping workbench? If so, please
> provide this project.xml
> -Are any error messages or warning logged to the console during context
> creation?
> 
> Also in your description, you say that the mapped XPATH is
> EMPL_INFO/EMPL_FIRST_NAME/text() however in the provided instance doc EMPLINFO
> doesn't contain an underscore. Double check your xpaths vs your instance doc to
> make sure that this is correct.
Comment 3 Raj CLA 2010-05-20 14:33:45 EDT
Created attachment 169395 [details]
Sessions.xml file
Comment 4 Matt MacIvor CLA 2010-05-28 10:23:24 EDT
The attached sessions.xml file is incomplete. It's missing the </sessions> closing tag. Without this it's possible that EclipseLink JAXB isn't loading your mapping meta-data and is instead attempting to use JAXB defaults.
Comment 5 Blaise Doughan CLA 2010-06-02 15:32:41 EDT
Changing target to 2.1.1:

We have been unable to recreate the issue.  Currently Matt is waiting on more information from Raj on this issue.
Comment 6 Matt MacIvor CLA 2010-06-29 14:28:07 EDT
I believe this problem was related to bug 318357 which was causing some Direct Mappings to fail to correctly unmarshal if there were unmapped elements in the instance document.

A fix for that bug has been checked into SVN in the 2.1 and Trunk streams and will start appearing in the nightly builds. 

I'm closing this bug as a duplicate of 318357. If this issue persists even with the fix for that bug, please re-open and provide more details to reproduce.

-Matt

*** This bug has been marked as a duplicate of bug 318357 ***
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:35:38 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink