Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Example using EclipseLink+MongoDB+XML Mappings

Hello again, ELUsers. Perhaps there really aren't any complete EclipseLink/MongoDB/XML tutorials out there and if not, perhaps one of you good folks could help me with something strange. I am successfully persisting an Entity which has an Embeddable field in it, but all of the values of fields (primitive fields) get set to '{"#text": null}'. Example:

> db.WACTION.findOne()
{
    "_id" : ObjectId("51a573f73004703030fca204"),
    "wactionid" : {
        "#text" : null
    },
    "UUID" : {
        "uuid_clockSeqAndNode" : {
            "#text" : null
        },
        "uuid_time" : {
            "#text" : null
        }
    },
    "STATUS" : {
        "#text" : null
    },
    "TS" : {
        "#text" : null
    }
}

When I searched the internet for clues all I could find were references to XML processing or XML-JSON translation:

http://www.bramstein.com/projects/xsltjson/
http://stackoverflow.com/questions/8184775/how-to-select-values-from-xml-in-sql
https://code.google.com/p/x2js/source/browse/xml2json.js?r=c187154dca3cfd3eba4f782da0deb89875f08e5e

I'm not trying to move data from or to XML format so I don't even know if that is related to my problem. I know that the default DataFormatType for non-relational databases in EclipseLink is XML, so I made sure to set the "dataFormat":

<entity name="Waction" class="com.x.waction.Waction">
    <no-sql dataFormat="DataFormatType.MAPPED" />
    <attributes>
        <id name="id" />
    
        <basic name="mapKey">
            <column name="wactionid" nullable="false" />
            <access-methods get-method="getMapKeyString" set-method="setMapKeyString" />
        </basic>
        
        <basic name="ts" />
        <basic name="status" />
        <embedded name="uuid" />
        <embedded name="context" />
    </attributes>
</entity>

I'm a novice with EclipseLink so I might be missing something basic, but I also wonder if the XML mapping for "no-sql" might not correctly implement the "dataFormat" parameter.

Has anyone seen anything like this?

Nicholas




On Tue, May 28, 2013 at 2:50 PM, Nicholas Keene <nicholas@xxxxxxxxx> wrote:
Hello, ELUsers, I am new to the list. I'm tasked with using EclipseLink to persist into MongoDB using XML mappings. I've found some examples using annotations, such as this one, but none using XML mappings.


I've tried for a couple days now to turn my working XML mappings for relational databases into working mappings for MongoDB, but I can't get it right. I thought maybe you folks could help me find an example to start from.

Thanks!
Nicholas in Wisconsin


Back to the top