Mined Opinions For API: eclipselink

This tab contains all the opinions collected from Stack Overflow about the API. The other tabs present summaries of the opinions using different algorithms.
  • Works fine, but I have to do it in this way inside the resource method: JAXBContext context JAXBContextFactory.createContext(new Class[] {ONIXMessage.class}, null); How can I fetch the eclipselink JAXBContext from Jersey?. details
  • made my day!.. details
  • Thanks Blaise!.. details
  • @sasankad - Good catch.. details
  • This is also one of the good solutions.. details
  • @BlaiseDoughan Thanks for the link, I did not know that!. details
  • thanks!. details
  • So it is not possible to enable json support in 2.0 without having to write code?. details
  • Thanks for Reply.. details
  • Here is an example of how we do it in EclipseLink MOXy: URL_http://blog.bdoughan.com/2013/03/moxys-xmlinversereference-is-now-truly.html .. details
  • @BDoughan : Yes I have tried this with eclipseLink and it works well.. details
  • Thanks for the answer!. details
  • This is what I'm doing, !. details
  • Especially Blaise Doughan answers where very helpful.Search for CODESNIPPET_JAVA2 .. details
  • Thank You so much for your reply.. details
  • Thank You so much for your reply.. details
  • Thank U so much for your response.. details
  • I would recommend the following: CODESNIPPET_JAVA2 .. details
  • Also it would be useful if the eclipselink maven repository was browsable, the URL_http://download.eclipse.org/rt/eclipselink/maven.repo page doesn't given any indication of changes made to the snapshot.. details
  • Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement.. details
  • I have to be honest though, I really don't like the idea of having to manage an XML file in addition to my POJO to apply the "views".. details
  • thanks for the information!. details
  • I have a relatively simple RESTful web service which uses Jersey and Eclipselink MOXy.. details
  • The interesting thing is that I can successfully unmarshall the exact same JSON string if I plug it into this code: CODESNIPPET_JAVA4 .. details
  • The service-side looks like this: CODESNIPPET_JAVA1 .. details
  • In my XML I only output an element if it has a value, but the requirement for the JSON is to output the value even if not set i.eXml CODESNIPPET_JAVA1 .. details
  • Specifying MOXy as your JSON-Binding Provider** In a RESTful environment you can specify CODETERM1 as the CODETERM2 / CODETERM3 for your JAX-RS application URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] In the standalone example below you can specify a CODETERM4 file in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html ] ): CODESNIPPET_JAVA2 .. details
  • Demo Code** Below is a standalone example you can run to prove that everything works: CODESNIPPET_JAVA3 .. details
  • Specifying MOXy as your JSON-Binding Provider** In a RESTful environment you can specify CODETERM1 as the CODETERM2 / CODETERM3 for your JAX-RS application URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] In the standalone example below you can specify a CODETERM4 file in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html ] ): CODESNIPPET_JAVA2 .. details
  • Is their a good way to export a mixed HashMap list?. details
  • Demo Since a type qualifier will be marshalled out a key will need to be written for the value.. details
  • When the CODETERM8 is equal to CODETERM9 the CODETERM10 value is not marshalled.. details
  • I have opened the following enhancement request to make this use case even easier to handle: URL_http://bugs.eclipse.org/406375 [ URL_http://bugs.eclipse.org/406375 ] .. details
  • I have opened the following enhancement request to make this use case even easier to handle: URL_http://bugs.eclipse.org/406375 [ URL_http://bugs.eclipse.org/406375 ] .. details
  • You can download a nightly build from the following location: URL_http://www.eclipse.org/eclipselink/downloads/nightly.php [ URL_http://www.eclipse.org/eclipselink/downloads/nightly.php ] ClassA We will use MOXy's object graph extension to specify a subset of values that can be marshalled.. details
  • Foo You can take advantage of MOXy's path based mapping for this use case.. details
  • You may be interested in the JSON-binding in EclipseLink MOXy (see: URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html) .. details
  • Thanks that works.. details
  • A fixed list, 5 different values.. details
  • BTW @Blaise Doughan your replies are fantastic but Ive looked at the eclipselink site and cannot find any of this information documented there, is it ?. details
  • I can't thank you enough for this solution, Blaise!.. details
  • I've added EclipseLink to the Eclipse forums I'm active in, but I have successfully integrated this solution into my Jersey ReST server application.. details
  • I can't thank you enough for this solution, Blaise!.. details
  • I've added EclipseLink to the Eclipse forums I'm active in, but I have successfully integrated this solution into my Jersey ReST server application.. details
  • Would you like to take this out of stackoverflow into the EclipseLink forum, or elsewhere?. details
  • Jersey is a great JAX-RS framework, EclipseLink provides JAXB & JPA implementations and is not a Jersey replacement.. details
  • The demo works fine, of course.. details
  • EclipseLink JAXB (MOXy) offers native JSON-binding (I'm the MOXy lead) with it you could do something like: CODESNIPPET_JAVA6 .. details
  • You may be interested in the JSON support we've added to EclipseLink JAXB (MOXy).. details
  • Thanks,Behzad .. details
  • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON- binding implementation and it may be a better fit for you use case: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html [ URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html ] .. details
  • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON- binding implementation and it may be a better fit for you use case: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html [ URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html ] .. details
  • This is great, thank you for the detailed answer!.. details
  • Looks like getJAXBContext() in MOXyJSONProvider might not be picking up a context correctly (and thus creating a JAXB context that doesn't know what "eclipselink.media-type" is).. details
  • Can you please provide more details on any additional code changes that would be required (other than what's listed above).. details
  • I would recommend entering this as an enhancement request against the CODETERM4 component: URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink [ URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink ] .. details
  • Also it would be useful if the eclipselink maven repository was browsable, the download.eclipse.org/rt/eclipselink/maven.repo page doesn't given any indication of changes made to the snapshot.. details
  • Everything was working fine with my maven enabled project.. details
  • Below is how you an support your use case with your CODETERM1 class as annotated with EclipseLink JAXB (MOXy).. details
  • Below is an example where the same object model is mapped to two different weather services (Google and Yahoo) URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] MOXy also supports both XML and JSON binding: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] MOXy also integrates easily with JAX-RS implementations: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] .. details
  • Below is an example where the same object model is mapped to two different weather services (Google and Yahoo) URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] MOXy also supports both XML and JSON binding: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] MOXy also integrates easily with JAX-RS implementations: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] .. details
  • @Crozin - I had to put in a fix to handle URL property so the complete example will require tonights build, but everything else works with the current build.. details
  • All answers are correct in a way but i found yours as the most complete.. details
  • works fine but adding CODESNIPPET_JAVA7 .. details
  • My original question showed a simpler case then the reality, so below Ive actually output the full output in case someone can see what could be causing the problem CODESNIPPET_JAVA6 .. details
  • EDIT:**Thanks for the answer but it appears to be the same as what I'm doing except your example code which I've tried out works okay.. details
  • I tried adding more elements to the example code to try and break it without success.. details
  • The CODETERM7 mechanism was used to specify that the CODETERM8 field had a CODETERM9 value, this has been translated to the proper null representation in the JSON output.. details
  • Even though the CODETERM3 field was mapped with CODETERM4 there are no special indication of this in the JSON message.. details
  • Since you already have established JAXB mappings and are converting XML to JSON, you may be interested in EclipseLink JAXB (MOXy) which offers both object-to-XML and object-to-JSON mapping using the same JAXB metadata.. details
  • Hope this helps, Rick .. details
  • Demo Below is a standalone example you can run to prove everything works.. details
  • Other JSON libraries offer a more generic DOM like structure.. details
  • Below is what your object model could look like.. details
  • You could leverage the JSON-Binding and external mapping document in EclipseLink JAXB (MOXy) to support your use case.. details
  • For URL_http://www.eclipse.org/eclipselink/moxy.php [EclipseLink-JAXB-(MOXy)] 's JSON binding, the correct mapping would be the following.. details
  • It will correctly marshal collections of size 1 wrapped as a JSON array.. details
  • EclipseLink JAXB (MOXy) provides native JSON-binding support.. details
  • You can change this behaviour by setting the CODETERM2 property on CODETERM3 to true.. details
  • EclipseLink JAXB (MOXy) offers native support for JSON.. details
  • Thank you for your answer.. details
  • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] One of the things that make MOXy so flexible is its path based mapping which breaks the one-to-one relationship between objects and nodes in XML and JSON messages: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html [ URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html ] Plus since URL_http://www.eclipse.org/eclipselink/jpa.php [EclipseLink-as- offers-a-JPA-implementation] , MOXy contains extensions for handling objects that are also mapped to the database: URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html [ URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html ] URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA [ URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA ] .. details
  • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] One of the things that make MOXy so flexible is its path based mapping which breaks the one-to-one relationship between objects and nodes in XML and JSON messages: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html [ URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html ] Plus since URL_http://www.eclipse.org/eclipselink/jpa.php [EclipseLink-as- offers-a-JPA-implementation] , MOXy contains extensions for handling objects that are also mapped to the database: URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html [ URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html ] URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA [ URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA ] .. details
  • URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html [ URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html ] In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 ] .. details
  • URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html [ URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html ] In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 ] .. details
  • Ah, thankyou sorry I thought you were just reiterating the answer to my other question URL_http://stackoverflow.com/questions/16931910/with-eclipselink-moxy - how-do-i-map-xml-content-to-a-name-different-to-value and because I used the alternative solution you gave I didnt see the need for it.I don't fully understand this but its now working :).. details
  • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink - moxy.html.. details
  • The exception being thrown is an RI exception (com.sun.xml.internal.bind.v2.runtime package) so EclipseLink MOXy is not being picked up as the JAXB provider.. details
  • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.. details
  • Ah, thankyou sorry I thought you were just reiterating the answer to my other question URL_http://stackoverflow.com/questions/16931910/with-eclipselink-moxy - how-do-i-map-xml-content-to-a-name-different-to-value and because I used the alternative solution you gave I didnt see the need for it.I don't fully understand this but its now working :).. details
  • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.. details
  • The exception being thrown is an RI exception (com.sun.xml.internal.bind.v2.runtime package) so EclipseLink MOXy is not being picked up as the JAXB provider.. details
  • I receive this exception because of the following line of code: CODESNIPPET_JAVA1 .. details
  • Exception in thread "main" javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json.. details
  • Exception in thread "main" javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json.. details
  • I receive this exception because of the following line of code: CODESNIPPET_JAVA1 .. details
  • Using EclipseLink MOXy, you can add properties to manipulate the output.. details
  • On a side note, I'm also not able to use the new XmlVariableNode in Eclipselink 2.6 as I'm only allowed to use stable releases of the API :( CODETERM1 has also been included in EclipseLink 2.5.1 which is now released: URL_http://www.eclipse.org/eclipselink/downloads/ [ URL_http://www.eclipse.org/eclipselink/downloads/ ] This annotation is well suited for mapping your use case: URL_http://blog.bdoughan.com/2013/06/moxys-xmlvariablenode-using-maps-key-as.html [ URL_http://blog.bdoughan.com/2013/06/moxys-xmlvariablenode-using-maps-key-as.html ] .. details
  • I am getting the below exception when the JSON string contains the '\' character.. details
  • Unfortunately, I'm unable to unmarshal to MyObject in reverse due to the usage of XmlPath to collapse the outer meta element.. details
  • For More Information** URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html [ URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html ] .. details
  • EDIT**:This is what Fiddler captures when I post the JSON data: CODESNIPPET_JAVA7 .. details
  • The actual model is a little more complex then Ive posted but the additional elements dont seem relevant to the issue.. details
  • Setting the type to be CODETERM2 will force a type qualified to be written out.. details
  • By default this will be CODETERM3 .. details
  • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA2 .. details
  • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA2 .. details
  • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA3 .. details
  • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA3 .. details
  • Thankyou that was the problem.. details
  • Thankyou that was the problem.. details
  • FYI WebLogic switched to MOXy as the default JAXB provider: URL_http://blog.bdoughan.com/2011/12/eclipselink-moxy-is-jaxb - provider-in.html.. details
  • In short, I've grep'd and jar tf'd all the source code and JAR files in EclipseLink for this symbol to no avail so far.. details
  • Also, as noted, project restrictions make it difficult to walk the whole framework route.. details
  • Thanks (and sorry for the lameness here).. details
  • Why is it using array indicators "[]", while bird, cat, and dog are not arrays?Second, is there a way to get rid of "bird", "cat", and "dog"?. details
  • Why is it using array indicators "[]", while bird, cat, and dog are not arrays?Second, is there a way to get rid of "bird", "cat", and "dog"?. details
  • Key By specifying CODETERM2 the contents of the reference object are pulled up into the node corresponding to the source object.. details
  • This tells MOXy to bring the contents of the target object into the sources node.. details
  • I downloaded and tried it with 2.4.0-M18, but I'm still getting the same exception.. details
  • I downloaded and tried it with 2.4.0-M18, but I'm still getting the same exception.. details
  • @Oleksi - The JSON binding is being added to 2.4.0, instead of a snap shot you can use a milestone 2.4.0-M18 URL_http://www.eclipse.org/eclipselink/downloads/milestones.php .. details
  • I switched to MOXyJSONProvider given in your example and then I get an exception: javax.ws.rs.WebApplicationException: javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json at MOXyJSONProvider.writeTo(MOXyJSONProvider.java:58).. details
  • This best mechanisms for this are: EclipseLink Forum: URL_http://www.eclipse.org/forums/index.php?t=thread&frm_id=111 [ URL_http://www.eclipse.org/forums/index.php?t=thread&frm_id=111 ] EclipseLink Users Mailing List: eclipselink-users AT eclipse.org** Enter a Bug: URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink [ URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink ] For More Information** URL_http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html [ URL_http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html ] UPDATE Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement.. details
  • I can fix it my modifying my DiscList.java class and adding to propOrder as suggested by the exception i.e from CODESNIPPET_JAVA3 .. details
  • but then my resultant json is incorrect (because I need to rename count to disc-count).. details
  • I can fix it my modifying my DiscList.java class and adding to propOrder as suggested by the exception i.e from CODESNIPPET_JAVA3 .. details
  • But when I rebuilt it today tests started to fail withe error CODESNIPPET_JAVA1 .. details
  • So the question really is what has changed in MOXy, and has this change introduced a bug ?. details
  • I could resolve it by removing the offending mapping from oxml.xml CODESNIPPET_JAVA2 .. details
  • But when I rebuilt it today tests started to fail withe error CODESNIPPET_JAVA1 .. details
  • but that is a pain because these classes are generated automatically from a schema, I don't want to have to manually edit them every time the schema changes.. details
  • I get the following exception CODESNIPPET_JAVA5 .. details
  • Because the Relation-List element contains both relation elements and a target-type attribute a straight conversion to json requires the relation-list element to enscapulate the two elements, i.e I think if the Relation-List element did not have a target-type attribute in the model it would work no problem.. details
  • I think i understand the problem.. details
  • By default URL_http://www.eclipse.org/eclipselink/moxy.php [EclipseLink- JAXB-(MOXy)] will marshal the JSON to one line.. details
  • To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2.1.12).. details
  • I also needed to use an CODETERM7 for the CODETERM8 property as the format you are using doesn't match MOXy's default representation.. details
  • For More Information** URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider_15.html [MOXy-as-Your-JAX-RS-JSON-Provider---Client-Side] URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider.html [MOXy-as-Your-JAX-RS-JSON-Provider---Server-Side] URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [Specifying-EclipseLink-MOXy-as-Your-JAXB-Provider] UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON-binding provider used by Jersey: URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html [ URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html ] .. details
  • For More Information** URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider_15.html [MOXy-as-Your-JAX-RS-JSON-Provider---Client-Side] URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider.html [MOXy-as-Your-JAX-RS-JSON-Provider---Server-Side] URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [Specifying-EclipseLink-MOXy-as-Your-JAXB-Provider] UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON-binding provider used by Jersey: URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html [ URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html ] .. details
  • Someone suggested a way to solve my problem (in URL_http://stackoverflow.com/questions/5881058/how-to-map-a-bean-structure-to-a -different-schema-with-jax-rs), although it requires using Eclipselink Moxy, which I don't want to introduce (additional dependency and jaxb replacement in whole application).. details
  • You can leverage the @XmlPath extension in EclipseLink JAXB (MOXy) to break the relationship between then entity model and the message format (I'm the MOXy tech lead): URL_http://stackoverflow.com/questions/4889913/jaxb2-mapping-nested-elements-into-the-same-java-class/4890120#4890120 [JAXB2:-Mapping-nested-elements-into-the-same-Java-class] .. details
Summaries the opinions about eclipselink using topic modeling.
  • 0. moxy jaxb binding offer native message case answer follow provide: 10
    • Thank U so much for your response.. details
    • I have opened the following enhancement request to make this use case even easier to handle: .. details
    • EclipseLink JAXB (MOXy) offers native JSON-binding (I'm the MOXy lead) with it you could do something like: CODESNIPPET .. details
    • All answers are correct in a way but i found yours as the most complete.. details
    • Even though the id field was mapped with @XmlAttribute there are no special indication of this in the JSON message.. details
    • Other JSON libraries offer a more generic DOM like structure.. details
    • It will correctly marshal collections of size 1 wrapped as a JSON array.. details
    • EclipseLink JAXB (MOXy) provides native JSON-binding support.. details
    • EclipseLink JAXB (MOXy) offers native support for JSON.. details
    • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: One of the things that make MOXy so flexible is its path based mapping which breaks the one-to-one relationship between objects and nodes in XML and JSON messages: Plus since EclipseLink-as- offers-a-JPA-implementation] , MOXy contains extensions for handling objects that are also mapped to the database: .. details
  • 1. moxy jaxb interest mapping null add binding model yahoo weather: 9
    • Here is an example of how we do it in EclipseLink MOXy: .. details
    • Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement.. details
    • You may be interested in the JSON-binding in EclipseLink MOXy (see: .. details
    • You may be interested in the JSON support we've added to EclipseLink JAXB (MOXy).. details
    • Below is an example where the same object model is mapped to two different weather services (Google and Yahoo) MOXy also supports both XML and JSON binding: MOXy also integrates easily with JAX-RS implementations: .. details
    • works fine but adding CODESNIPPET .. details
    • I tried adding more elements to the example code to try and break it without success.. details
    • The xsi:nil mechanism was used to specify that the lastName field had a null value, this has been translated to the proper null representation in the JSON output.. details
    • Since you already have established JAXB mappings and are converting XML to JSON, you may be interested in EclipseLink JAXB (MOXy) which offers both object-to-XML and object-to-JSON mapping using the same JAXB metadata.. details
  • 2. write enable forum stackoverflow reply answer moxy add solution blaise: 4
    • So it is not possible to enable json support in 2.0 without having to write code?. details
    • Thanks for Reply.. details
    • Thank You so much for your reply.. details
    • Would you like to take this out of stackoverflow into the EclipseLink forum, or elsewhere?. details
  • 3. output case change marshal ive simple original browsable question full: 8
    • This is also one of the good solutions.. details
    • Thanks Blaise!.. details
    • Demo Code** Below is a standalone example you can run to prove that everything works: CODESNIPPET .. details
    • When the status is equal to deleted the property1 value is not marshalled.. details
    • I can't thank you enough for this solution, Blaise!.. details
    • My original question showed a simpler case then the reality, so below Ive actually output the full output in case someone can see what could be causing the problem CODESNIPPET .. details
    • Demo Below is a standalone example you can run to prove everything works.. details
    • You can change this behaviour by setting the nillable property on @XmlElement to true.. details
  • 4. model change provide additional detail require maven enable jaxb moxy: 3
    • Can you please provide more details on any additional code changes that would be required (other than what's listed above).. details
    • Everything was working fine with my maven enabled project.. details
    • Below is what your object model could look like.. details
  • 5. jersey jax jaxb provide jpa replacement implementation binding messagebodywriter standalone: 3
    • Specifying MOXy as your JSON-Binding Provider** In a RESTful environment you can specify MOXyJsonProvider as the MessageBodyReader / MessageBodyWriter for your JAX-RS application In the standalone example below you can specify a jaxb.properties file in the same package as your domain model with the following entry (see: ): CODESNIPPET .. details
    • Jersey is a great JAX-RS framework, EclipseLink provides JAXB & JPA implementations and is not a Jersey replacement.. details
    • Thanks,Behzad .. details
  • 6. maven moxy indication repository change eclipse snapshot browsable download repo: 5
    • @BlaiseDoughan Thanks for the link, I did not know that!. details
    • I would recommend the following: CODESNIPPET .. details
    • Also it would be useful if the eclipselink maven repository was browsable, the page doesn't given any indication of changes made to the snapshot.. details
    • I have to be honest though, I really don't like the idea of having to manage an XML file in addition to my POJO to apply the "views".. details
    • Also it would be useful if the eclipselink maven repository was browsable, the download.eclipse.org/rt/eclipselink/maven.repo page doesn't given any indication of changes made to the snapshot.. details
  • 7. moxy jaxb build case follow extension answer marshal mapping output: 21
    • thanks!. details
    • made my day!.. details
    • This is what I'm doing, !. details
    • Especially Blaise Doughan answers where very helpful.Search for CODESNIPPET .. details
    • thanks for the information!. details
    • In my XML I only output an element if it has a value, but the requirement for the JSON is to output the value even if not set i.eXml CODESNIPPET .. details
    • Is their a good way to export a mixed HashMap list?. details
    • Demo Since a type qualifier will be marshalled out a key will need to be written for the value.. details
    • You can download a nightly build from the following location: ClassA We will use MOXy's object graph extension to specify a subset of values that can be marshalled.. details
    • Foo You can take advantage of MOXy's path based mapping for this use case.. details
    • Thanks that works.. details
    • A fixed list, 5 different values.. details
    • The demo works fine, of course.. details
    • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON- binding implementation and it may be a better fit for you use case: Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: .. details
    • This is great, thank you for the detailed answer!.. details
    • I would recommend entering this as an enhancement request against the build component: .. details
    • Below is how you an support your use case with your Student class as annotated with EclipseLink JAXB (MOXy).. details
    • @Crozin - I had to put in a fix to handle URL property so the complete example will require tonights build, but everything else works with the current build.. details
    • You could leverage the JSON-Binding and external mapping document in EclipseLink JAXB (MOXy) to support your use case.. details
    • For EclipseLink-JAXB-(MOXy) 's JSON binding, the correct mapping would be the following.. details
    • In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: .. details
  • 8. jaxb context reply answer add moxy blaise solution case binding: 9
    • Thanks for the answer!. details
    • @sasankad - Good catch.. details
    • @BDoughan : Yes I have tried this with eclipseLink and it works well.. details
    • BTW @Blaise Doughan your replies are fantastic but Ive looked at the eclipselink site and cannot find any of this information documented there, is it ?. details
    • I've added EclipseLink to the Eclipse forums I'm active in, but I have successfully integrated this solution into my Jersey ReST server application.. details
    • Looks like getJAXBContext() in MOXyJSONProvider might not be picking up a context correctly (and thus creating a JAXB context that doesn't know what "eclipselink.media-type" is).. details
    • EDIT:**Thanks for the answer but it appears to be the same as what I'm doing except your example code which I've tried out works okay.. details
    • Hope this helps, Rick .. details
    • Thank you for your answer.. details
  • 9. jaxbcontext jersey service moxy context inside fetch null resource onixmessage: 4
    • Works fine, but I have to do it in this way inside the resource method: JAXBContext context JAXBContextFactory.createContext(new Class[] {ONIXMessage.class}, null); How can I fetch the eclipselink JAXBContext from Jersey?. details
    • I have a relatively simple RESTful web service which uses Jersey and Eclipselink MOXy.. details
    • The interesting thing is that I can successfully unmarshall the exact same JSON string if I plug it into this code: CODESNIPPET .. details
    • The service-side looks like this: CODESNIPPET .. details
  • 0. jaxb relation html model moxy target attribute call include provider: 4
    • Ah, thankyou sorry I thought you were just reiterating the answer to my other question - how-do-i-map-xml-content-to-a-name-different-to-value and because I used the alternative solution you gave I didnt see the need for it.I don't fully understand this but its now working :).. details
    • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry (see: your.html [ - your.html] ): CODESNIPPET .. details
    • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry (see: your.html [ - your.html] ): CODESNIPPET .. details
    • Because the Relation-List element contains both relation elements and a target-type attribute a straight conversion to json requires the relation-list element to enscapulate the two elements, i.e I think if the Relation-List element did not have a target-type attribute in the model it would work no problem.. details
  • 1. moxyjsonprovider moxy javax provider switch exception jaxb html propertyexception bind: 4
    • FYI WebLogic switched to MOXy as the default JAXB provider: - provider-in.html.. details
    • I switched to MOXyJSONProvider given in your example and then I get an exception: javax.ws.rs.WebApplicationException: javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json at MOXyJSONProvider.writeTo(MOXyJSONProvider.java:58).. details
    • This best mechanisms for this are: EclipseLink Forum: EclipseLink Users Mailing List: eclipselink-users AT eclipse.org** Enter a Bug: For More Information** UPDATE Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement.. details
    • I also needed to use an XmlAdapter for the Date property as the format you are using doesn't match MOXy's default representation.. details
  • 2. moxy provider jaxb exception jax side jersey binding bind glassfish: 8
    • The exception being thrown is an RI exception (com.sun.xml.internal.bind.v2.runtime package) so EclipseLink MOXy is not being picked up as the JAXB provider.. details
    • I receive this exception because of the following line of code: CODESNIPPET .. details
    • Unfortunately, I'm unable to unmarshal to MyObject in reverse due to the usage of XmlPath to collapse the outer meta element.. details
    • Setting the type to be Object will force a type qualified to be written out.. details
    • But when I rebuilt it today tests started to fail withe error CODESNIPPET .. details
    • I think i understand the problem.. details
    • By default EclipseLink- JAXB-(MOXy)] will marshal the JSON to one line.. details
    • For More Information** MOXy-as-Your-JAX-RS-JSON-Provider---Client-Side MOXy-as-Your-JAX-RS-JSON-Provider---Server-Side Specifying-EclipseLink-MOXy-as-Your-JAXB-Provider UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON-binding provider used by Jersey: .. details
  • 3. exception moxy change xmlvariablenode release javax bird media bind schema: 12
    • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.. details
    • Exception in thread "main" javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json.. details
    • Using EclipseLink MOXy, you can add properties to manipulate the output.. details
    • On a side note, I'm also not able to use the new XmlVariableNode in Eclipselink 2.6 as I'm only allowed to use stable releases of the API :( @XmlVariableNode has also been included in EclipseLink 2.5.1 which is now released: This annotation is well suited for mapping your use case: .. details
    • I am getting the below exception when the JSON string contains the '\' character.. details
    • For More Information** .. details
    • By default this will be value .. details
    • Why is it using array indicators "[]", while bird, cat, and dog are not arrays?Second, is there a way to get rid of "bird", "cat", and "dog"?. details
    • This tells MOXy to bring the contents of the target object into the sources node.. details
    • but that is a pain because these classes are generated automatically from a schema, I don't want to have to manually edit them every time the schema changes.. details
    • So the question really is what has changed in MOXy, and has this change introduced a bug ?. details
    • I get the following exception CODESNIPPET .. details
  • 4. count rename disc resultant jaxb html mailing entry eclipse answer: 1
    • but then my resultant json is incorrect (because I need to rename count to disc-count).. details
  • 5. add exception m18 moxy binding milestone oleksi shot snap disclist: 6
    • Thankyou that was the problem.. details
    • In short, I've grep'd and jar tf'd all the source code and JAR files in EclipseLink for this symbol to no avail so far.. details
    • I downloaded and tried it with 2.4.0-M18, but I'm still getting the same exception.. details
    • @Oleksi - The JSON binding is being added to 2.4.0, instead of a snap shot you can use a milestone 2.4.0-M18 .. details
    • I can fix it my modifying my DiscList.java class and adding to propOrder as suggested by the exception i.e from CODESNIPPET .. details
    • You can leverage the @XmlPath extension in EclipseLink JAXB (MOXy) to break the relationship between then entity model and the message format (I'm the MOXy tech lead): JAXB2:-Mapping-nested-elements-into-the-same-Java-class .. details
  • 6. moxy jaxb create solve jax additional schema introduce model require: 4
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): - moxy.html.. details
    • Key By specifying @XmlPath(".") the contents of the reference object are pulled up into the node corresponding to the source object.. details
    • To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2.1.12).. details
    • Someone suggested a way to solve my problem (in -different-schema-with-jax-rs), although it requires using Eclipselink Moxy, which I don't want to introduce (additional dependency and jaxb replacement in whole application).. details
  • 7. post model actual ive dont relevant oxml mapping additional fiddler: 5
    • EDIT**:This is what Fiddler captures when I post the JSON data: CODESNIPPET .. details
    • The actual model is a little more complex then Ive posted but the additional elements dont seem relevant to the issue.. details
    • Also, as noted, project restrictions make it difficult to walk the whole framework route.. details
    • Thanks (and sorry for the lameness here).. details
    • I could resolve it by removing the offending mapping from oxml.xml CODESNIPPET .. details
Summaries of the opinions about eclipselink using three algorithms (Textrank, Lexrank and Luhn) adopted from extractive summarization. Each algorithm was used once for the positive opinions and once for the negative opinions.
  • Below is how you an support your use case with your Student class as annotated with EclipseLink JAXB (MOXy) .
  • EclipseLink JAXB (MOXy) offers native JSON binding (I'm the MOXy lead) with it you could do something like: CODESNIPPET JAVA6 .
  • Demo Since a type qualifier will be marshalled out a key will need to be written for the value .
  • In my XML I only output an element if it has a value, but the requirement for the JSON is to output the value even if not set i eXml CODESNIPPET JAVA1 .
  • For EclipseLink JAXB (MOXy) 's JSON binding, the correct mapping would be the following .
  • Can you please provide more details on any additional code changes that would be required (other than what's listed above) .
  • EDIT:**Thanks for the answer but it appears to be the same as what I'm doing except your example code which I've tried out works okay .
  • You could leverage the JSON Binding and external mapping document in EclipseLink JAXB (MOXy) to support your use case .
  • Specifying MOXy as your JSON Binding Provider** In a RESTful environment you can specify MOXyJsonProvider as the MessageBodyReader MessageBodyWriter for your JAX RS application In the standalone example below you can specify a jaxb.properties file in the same package as your domain model with the following entry (see: ): CODESNIPPET JAVA2 .
  • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON binding implementation and it may be a better fit for you use case: Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: .
  • In my XML I only output an element if it has a value, but the requirement for the JSON is to output the value even if not set i eXml CODESNIPPET JAVA1 .
  • The xsi:nil mechanism was used to specify that the lastName field had a null value, this has been translated to the proper null representation in the JSON output .
  • Since you already have established JAXB mappings and are converting XML to JSON, you may be interested in EclipseLink JAXB (MOXy) which offers both object to XML and object to JSON mapping using the same JAXB metadata .
  • EDIT:**Thanks for the answer but it appears to be the same as what I'm doing except your example code which I've tried out works okay .
  • In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: .
  • Also it would be useful if the eclipselink maven repository was browsable, the download eclipse org rt eclipselink maven repo page doesn't given any indication of changes made to the snapshot .
  • Specifying MOXy as your JSON Binding Provider** In a RESTful environment you can specify MOXyJsonProvider as the MessageBodyReader MessageBodyWriter for your JAX RS application In the standalone example below you can specify a jaxb.properties file in the same package as your domain model with the following entry (see: ): CODESNIPPET JAVA2 .
  • I have to be honest though, I really don't like the idea of having to manage an XML file in addition to my POJO to apply the "views" .
  • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON binding implementation and it may be a better fit for you use case: Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: .
  • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: One of the things that make MOXy so flexible is its path based mapping which breaks the one to one relationship between objects and nodes in XML and JSON messages: Plus since EclipseLink as offers a JPA implementation , MOXy contains extensions for handling objects that are also mapped to the database: .
  • In my XML I only output an element if it has a value, but the requirement for the JSON is to output the value even if not set i eXml CODESNIPPET JAVA1 .
  • Since you already have established JAXB mappings and are converting XML to JSON, you may be interested in EclipseLink JAXB (MOXy) which offers both object to XML and object to JSON mapping using the same JAXB metadata .
  • EDIT:**Thanks for the answer but it appears to be the same as what I'm doing except your example code which I've tried out works okay .
  • In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: .
  • Also it would be useful if the eclipselink maven repository was browsable, the download eclipse org rt eclipselink maven repo page doesn't given any indication of changes made to the snapshot .
  • Also it would be useful if the eclipselink maven repository was browsable, the page doesn't given any indication of changes made to the snapshot .
  • Specifying MOXy as your JSON Binding Provider** In a RESTful environment you can specify MOXyJsonProvider as the MessageBodyReader MessageBodyWriter for your JAX RS application In the standalone example below you can specify a jaxb.properties file in the same package as your domain model with the following entry (see: ): CODESNIPPET JAVA2 .
  • Below is an example where the same object model is mapped to two different weather services (Google and Yahoo) MOXy also supports both XML and JSON binding: MOXy also integrates easily with JAX RS implementations: .
  • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON binding implementation and it may be a better fit for you use case: Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: .
  • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: One of the things that make MOXy so flexible is its path based mapping which breaks the one to one relationship between objects and nodes in XML and JSON messages: Plus since EclipseLink as offers a JPA implementation , MOXy contains extensions for handling objects that are also mapped to the database: .
  • To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2 1 12) .
  • By default this will be value .
  • You can leverage the @XmlPath extension in EclipseLink JAXB (MOXy) to break the relationship between then entity model and the message format (I'm the MOXy tech lead): JAXB2: Mapping nested elements into the same Java class .
  • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
  • Ah, thankyou sorry I thought you were just reiterating the answer to my other question how do i map xml content to a name different to value and because I used the alternative solution you gave I didnt see the need for it I don't fully understand this but its now working :) .
  • I get the following exception CODESNIPPET JAVA5 .
  • I receive this exception because of the following line of code: CODESNIPPET JAVA1 .
  • Thanks for quick response I am facing javax xml bind JAXBException: property "eclipselink media type" is not supported exception .
  • For More Information** MOXy as Your JAX RS JSON Provider Client Side MOXy as Your JAX RS JSON Provider Server Side Specifying EclipseLink MOXy as Your JAXB Provider UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON binding provider used by Jersey: .
  • EDIT**:This is what Fiddler captures when I post the JSON data: CODESNIPPET JAVA7 .
  • You can leverage the @XmlPath extension in EclipseLink JAXB (MOXy) to break the relationship between then entity model and the message format (I'm the MOXy tech lead): JAXB2: Mapping nested elements into the same Java class .
  • Ah, thankyou sorry I thought you were just reiterating the answer to my other question how do i map xml content to a name different to value and because I used the alternative solution you gave I didnt see the need for it I don't fully understand this but its now working :) .
  • Because the Relation List element contains both relation elements and a target type attribute a straight conversion to json requires the relation list element to enscapulate the two elements, i e I think if the Relation List element did not have a target type attribute in the model it would work no problem .
  • This best mechanisms for this are: EclipseLink Forum: EclipseLink Users Mailing List: eclipselink users AT eclipse org** Enter a Bug: For More Information** UPDATE Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement .
  • the contents of the reference object are pulled up into the node corresponding to the source object .
  • jaxb properties To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry (see: your html your html ): CODESNIPPET JAVA3 .
  • For More Information** MOXy as Your JAX RS JSON Provider Client Side MOXy as Your JAX RS JSON Provider Server Side Specifying EclipseLink MOXy as Your JAXB Provider UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON binding provider used by Jersey: .
  • jaxb properties To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry (see: your html your html ): CODESNIPPET JAVA2 .
  • On a side note, I'm also not able to use the new XmlVariableNode in Eclipselink 2 6 as I'm only allowed to use stable releases of the API :( @XmlVariableNode has also been included in EclipseLink 2 5 1 which is now released: This annotation is well suited for mapping your use case: .
  • Unfortunately, I'm unable to unmarshal to MyObject in reverse due to the usage of XmlPath to collapse the outer meta element .
  • To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2 1 12) .
  • Someone suggested a way to solve my problem (in different schema with jax rs), although it requires using Eclipselink Moxy, which I don't want to introduce (additional dependency and jaxb replacement in whole application) .
  • Ah, thankyou sorry I thought you were just reiterating the answer to my other question how do i map xml content to a name different to value and because I used the alternative solution you gave I didnt see the need for it I don't fully understand this but its now working :) .
  • I switched to MOXyJSONProvider given in your example and then I get an exception: javax ws rs WebApplicationException: javax xml bind PropertyException: name: eclipselink media type value: application json at MOXyJSONProvider writeTo(MOXyJSONProvider java:58) .
  • Because the Relation List element contains both relation elements and a target type attribute a straight conversion to json requires the relation list element to enscapulate the two elements, i e I think if the Relation List element did not have a target type attribute in the model it would work no problem .
  • This best mechanisms for this are: EclipseLink Forum: EclipseLink Users Mailing List: eclipselink users AT eclipse org** Enter a Bug: For More Information** UPDATE Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement .
  • jaxb properties To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry (see: your html your html ): CODESNIPPET JAVA3 .
  • For More Information** MOXy as Your JAX RS JSON Provider Client Side MOXy as Your JAX RS JSON Provider Server Side Specifying EclipseLink MOXy as Your JAXB Provider UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON binding provider used by Jersey: .
  • jaxb properties To specify MOXy as your JAXB provider you need to include a file called jaxb.properties in the same package as your domain model with the following entry (see: your html your html ): CODESNIPPET JAVA2 .
  • On a side note, I'm also not able to use the new XmlVariableNode in Eclipselink 2 6 as I'm only allowed to use stable releases of the API :( @XmlVariableNode has also been included in EclipseLink 2 5 1 which is now released: This annotation is well suited for mapping your use case: .
Summaries of the opinions about eclipselink using Opinosis, an abstractive summarizer of opinions..
  • eclipselink jaxb (/( moxy )/) offers native json .
  • demo below is a standalone example you can run to prove everything works .
  • it would be useful if the eclipselink maven repository was browsable .
  • n't given any indication of changes made to the snapshot .
  • native support .
  • more information** .
Summaries of the opinions about eclipselink using contrastive viewpoints. Each entry contains a pair of positive and negative sentences that are most likely discussing about similar API features.
    • EclipseLink JAXB (MOXy) offers native JSON binding (I'm the MOXy lead) with it you could do something like: CODESNIPPET JAVA6 .
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
    • Here is an example of how we do it in EclipseLink MOXy: .
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
    • EclipseLink JAXB (MOXy) offers native support for JSON .
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
    • EclipseLink JAXB (MOXy) provides native JSON binding support .
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
    • For EclipseLink JAXB (MOXy) 's JSON binding, the correct mapping would be the following .
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
    • You may be interested in the JSON support we've added to EclipseLink JAXB (MOXy) .
    • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): moxy html .
Summaries of opinions about based on specific API aspects, such as, performance, usability, etc. The 'Overview' page provides an overview of the aspects detected in the opinions. The 'Trend' page shows the distribution of polarity over time for each aspect. The 'Positive Opinions' page groups positive opinions by the detected aspects. The 'Contrastive By Aspect' page shows paris of contrastive opinions under each aspect (where found).
Features:
  • made my day!.
  • EDIT**:This is what Fiddler captures when I post the JSON data: CODESNIPPET_JAVA7 .
Documentation:
  • Here is an example of how we do it in EclipseLink MOXy: URL_http://blog.bdoughan.com/2013/03/moxys-xmlinversereference-is-now-truly.html .
  • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink - moxy.html.
Community:
  • Hope this helps, Rick .
  • N/A
Onlysentiment:
  • Thanks Blaise!.
  • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.
Performance:
  • N/A
  • Why is it using array indicators "[]", while bird, cat, and dog are not arrays?Second, is there a way to get rid of "bird", "cat", and "dog"?
Bug:
  • I have opened the following enhancement request to make this use case even easier to handle: URL_http://bugs.eclipse.org/406375 [ URL_http://bugs.eclipse.org/406375 ] .
  • The exception being thrown is an RI exception (com.sun.xml.internal.bind.v2.runtime package) so EclipseLink MOXy is not being picked up as the JAXB provider.
Usability:
  • @BDoughan : Yes I have tried this with eclipseLink and it works well.
  • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.
  • Features: 12
    1. jaxb: 2
      • EclipseLink JAXB (MOXy) offers native JSON-binding (I'm the MOXy lead) with it you could do something like: CODESNIPPET_JAVA6 .. details
      • EclipseLink JAXB (MOXy) provides native JSON-binding support.. details
    2. json: 4
      • You may be interested in the JSON support we've added to EclipseLink JAXB (MOXy).. details
      • Even though the CODETERM3 field was mapped with CODETERM4 there are no special indication of this in the JSON message.. details
      • For URL_http://www.eclipse.org/eclipselink/moxy.php [EclipseLink-JAXB-(MOXy)] 's JSON binding, the correct mapping would be the following.. details
      • It will correctly marshal collections of size 1 wrapped as a JSON array.. details
    3. required: 1
      • Can you please provide more details on any additional code changes that would be required (other than what's listed above).. details
    4. moxy: 1
      • You may be interested in the JSON-binding in EclipseLink MOXy (see: URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html) .. details
    5. general: 4
      • made my day!.. details
      • Especially Blaise Doughan answers where very helpful.Search for CODESNIPPET_JAVA2 .. details
      • I would recommend the following: CODESNIPPET_JAVA2 .. details
      • The service-side looks like this: CODESNIPPET_JAVA1 .. details
  • Documentation: 8
    1. general: 8
      • Here is an example of how we do it in EclipseLink MOXy: URL_http://blog.bdoughan.com/2013/03/moxys-xmlinversereference-is-now-truly.html .. details
      • Specifying MOXy as your JSON-Binding Provider** In a RESTful environment you can specify CODETERM1 as the CODETERM2 / CODETERM3 for your JAX-RS application URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] In the standalone example below you can specify a CODETERM4 file in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html ] ): CODESNIPPET_JAVA2 .. details
      • BTW @Blaise Doughan your replies are fantastic but Ive looked at the eclipselink site and cannot find any of this information documented there, is it ?. details
      • I've added EclipseLink to the Eclipse forums I'm active in, but I have successfully integrated this solution into my Jersey ReST server application.. details
      • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON- binding implementation and it may be a better fit for you use case: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html [ URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html ] .. details
      • Below is an example where the same object model is mapped to two different weather services (Google and Yahoo) URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] MOXy also supports both XML and JSON binding: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] MOXy also integrates easily with JAX-RS implementations: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] .. details
      • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] One of the things that make MOXy so flexible is its path based mapping which breaks the one-to-one relationship between objects and nodes in XML and JSON messages: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html [ URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html ] Plus since URL_http://www.eclipse.org/eclipselink/jpa.php [EclipseLink-as- offers-a-JPA-implementation] , MOXy contains extensions for handling objects that are also mapped to the database: URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html [ URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html ] URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA [ URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA ] .. details
      • URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html [ URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html ] In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 ] .. details
  • Community: 1
    1. general: 1
  • Onlysentiment: 13
    1. general: 13
      • Thanks Blaise!.. details
      • @sasankad - Good catch.. details
      • @BlaiseDoughan Thanks for the link, I did not know that!. details
      • thanks!. details
      • Thanks for Reply.. details
      • Thanks for the answer!. details
      • This is what I'm doing, !. details
      • Thank You so much for your reply.. details
      • thanks for the information!. details
      • I can't thank you enough for this solution, Blaise!.. details
      • Thanks,Behzad .. details
      • This is great, thank you for the detailed answer!.. details
      • Thank you for your answer.. details
  • Bug: 4
    1. general: 4
      • I have opened the following enhancement request to make this use case even easier to handle: URL_http://bugs.eclipse.org/406375 [ URL_http://bugs.eclipse.org/406375 ] .. details
      • A fixed list, 5 different values.. details
      • I would recommend entering this as an enhancement request against the CODETERM4 component: URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink [ URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink ] .. details
      • My original question showed a simpler case then the reality, so below Ive actually output the full output in case someone can see what could be causing the problem CODESNIPPET_JAVA6 .. details
  • Usability: 47
    1. hashmap: 1
      • Is their a good way to export a mixed HashMap list?. details
    2. jax-rs: 1
      • Specifying MOXy as your JSON-Binding Provider** In a RESTful environment you can specify CODETERM1 as the CODETERM2 / CODETERM3 for your JAX-RS application URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] In the standalone example below you can specify a CODETERM4 file in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html ] ): CODESNIPPET_JAVA2 .. details
    3. object: 2
      • You can download a nightly build from the following location: URL_http://www.eclipse.org/eclipselink/downloads/nightly.php [ URL_http://www.eclipse.org/eclipselink/downloads/nightly.php ] ClassA We will use MOXy's object graph extension to specify a subset of values that can be marshalled.. details
      • Below is what your object model could look like.. details
    4. request: 1
      • I have opened the following enhancement request to make this use case even easier to handle: URL_http://bugs.eclipse.org/406375 [ URL_http://bugs.eclipse.org/406375 ] .. details
    5. mapping: 1
      • Foo You can take advantage of MOXy's path based mapping for this use case.. details
    6. pojo: 1
      • I have to be honest though, I really don't like the idea of having to manage an XML file in addition to my POJO to apply the "views".. details
    7. element: 1
      • Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement.. details
    8. maven: 3
      • Also it would be useful if the eclipselink maven repository was browsable, the URL_http://download.eclipse.org/rt/eclipselink/maven.repo page doesn't given any indication of changes made to the snapshot.. details
      • Also it would be useful if the eclipselink maven repository was browsable, the download.eclipse.org/rt/eclipselink/maven.repo page doesn't given any indication of changes made to the snapshot.. details
      • Everything was working fine with my maven enabled project.. details
    9. json: 8
      • So it is not possible to enable json support in 2.0 without having to write code?. details
      • The interesting thing is that I can successfully unmarshall the exact same JSON string if I plug it into this code: CODESNIPPET_JAVA4 .. details
      • In my XML I only output an element if it has a value, but the requirement for the JSON is to output the value even if not set i.eXml CODESNIPPET_JAVA1 .. details
      • EclipseLink JAXB (MOXy) offers support for all JAXB constructs in our JSON- binding implementation and it may be a better fit for you use case: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] Below is a link to some official Jersey examples that leverage MOXy as the JSON provider: URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html [ URL_https://github.com/jersey/jersey/blob/master/examples/json-moxy/README.html ] .. details
      • Below is an example where the same object model is mapped to two different weather services (Google and Yahoo) URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] MOXy also supports both XML and JSON binding: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] MOXy also integrates easily with JAX-RS implementations: URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] .. details
      • The CODETERM7 mechanism was used to specify that the CODETERM8 field had a CODETERM9 value, this has been translated to the proper null representation in the JSON output.. details
      • Other JSON libraries offer a more generic DOM like structure.. details
      • In the next example one object model is mapped to the results of both the Google and Yahoo weather APIs: URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html [ URL_http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html ] One of the things that make MOXy so flexible is its path based mapping which breaks the one-to-one relationship between objects and nodes in XML and JSON messages: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html ] URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html [ URL_http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html ] Plus since URL_http://www.eclipse.org/eclipselink/jpa.php [EclipseLink-as- offers-a-JPA-implementation] , MOXy contains extensions for handling objects that are also mapped to the database: URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html [ URL_http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html ] URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA [ URL_http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JPA ] .. details
    10. rest: 1
      • I've added EclipseLink to the Eclipse forums I'm active in, but I have successfully integrated this solution into my Jersey ReST server application.. details
    11. jaxb: 6
      • Looks like getJAXBContext() in MOXyJSONProvider might not be picking up a context correctly (and thus creating a JAXB context that doesn't know what "eclipselink.media-type" is).. details
      • Below is how you an support your use case with your CODETERM1 class as annotated with EclipseLink JAXB (MOXy).. details
      • Since you already have established JAXB mappings and are converting XML to JSON, you may be interested in EclipseLink JAXB (MOXy) which offers both object-to-XML and object-to-JSON mapping using the same JAXB metadata.. details
      • You could leverage the JSON-Binding and external mapping document in EclipseLink JAXB (MOXy) to support your use case.. details
      • EclipseLink JAXB (MOXy) offers native support for JSON.. details
      • URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html [ URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html ] In addition to the JAXB annotations MOXy extensions (such as @XmlPath) are supported making it even easier to have one annotated model that can be used for both XML and JSON: URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 [ URL_http://blog.bdoughan.com/2011/08/binding-to-json-xml-geocode-example.html?m=0 ] .. details
    12. general: 19
      • Works fine, but I have to do it in this way inside the resource method: JAXBContext context JAXBContextFactory.createContext(new Class[] {ONIXMessage.class}, null); How can I fetch the eclipselink JAXBContext from Jersey?. details
      • This is also one of the good solutions.. details
      • @BDoughan : Yes I have tried this with eclipseLink and it works well.. details
      • Thank You so much for your reply.. details
      • Thank U so much for your response.. details
      • Demo Code** Below is a standalone example you can run to prove that everything works: CODESNIPPET_JAVA3 .. details
      • Demo Since a type qualifier will be marshalled out a key will need to be written for the value.. details
      • When the CODETERM8 is equal to CODETERM9 the CODETERM10 value is not marshalled.. details
      • Thanks that works.. details
      • I can't thank you enough for this solution, Blaise!.. details
      • Would you like to take this out of stackoverflow into the EclipseLink forum, or elsewhere?. details
      • The demo works fine, of course.. details
      • @Crozin - I had to put in a fix to handle URL property so the complete example will require tonights build, but everything else works with the current build.. details
      • All answers are correct in a way but i found yours as the most complete.. details
      • works fine but adding CODESNIPPET_JAVA7 .. details
      • EDIT:**Thanks for the answer but it appears to be the same as what I'm doing except your example code which I've tried out works okay.. details
      • I tried adding more elements to the example code to try and break it without success.. details
      • Demo Below is a standalone example you can run to prove everything works.. details
      • You can change this behaviour by setting the CODETERM2 property on CODETERM3 to true.. details
    13. jersey: 2
      • I have a relatively simple RESTful web service which uses Jersey and Eclipselink MOXy.. details
      • Jersey is a great JAX-RS framework, EclipseLink provides JAXB & JPA implementations and is not a Jersey replacement.. details
  • Features: 9
    1. general: 9
      • EDIT**:This is what Fiddler captures when I post the JSON data: CODESNIPPET_JAVA7 .. details
      • By default this will be CODETERM3 .. details
      • Thanks (and sorry for the lameness here).. details
      • Key By specifying CODETERM2 the contents of the reference object are pulled up into the node corresponding to the source object.. details
      • This tells MOXy to bring the contents of the target object into the sources node.. details
      • I switched to MOXyJSONProvider given in your example and then I get an exception: javax.ws.rs.WebApplicationException: javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json at MOXyJSONProvider.writeTo(MOXyJSONProvider.java:58).. details
      • I could resolve it by removing the offending mapping from oxml.xml CODESNIPPET_JAVA2 .. details
      • By default URL_http://www.eclipse.org/eclipselink/moxy.php [EclipseLink- JAXB-(MOXy)] will marshal the JSON to one line.. details
      • You can leverage the @XmlPath extension in EclipseLink JAXB (MOXy) to break the relationship between then entity model and the message format (I'm the MOXy tech lead): URL_http://stackoverflow.com/questions/4889913/jaxb2-mapping-nested-elements-into-the-same-java-class/4890120#4890120 [JAXB2:-Mapping-nested-elements-into-the-same-Java-class] .. details
  • Documentation: 8
    1. general: 8
      • Here is a complete example of how this can be done with EclipseLink JAXB (MOXy): URL_http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink - moxy.html.. details
      • Ah, thankyou sorry I thought you were just reiterating the answer to my other question URL_http://stackoverflow.com/questions/16931910/with-eclipselink-moxy - how-do-i-map-xml-content-to-a-name-different-to-value and because I used the alternative solution you gave I didnt see the need for it.I don't fully understand this but its now working :).. details
      • For More Information** URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html [ URL_http://blog.bdoughan.com/2012/05/moxy-as-your-jax-rs-json-provider.html ] URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html [ URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html ] .. details
      • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA2 .. details
      • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA3 .. details
      • FYI WebLogic switched to MOXy as the default JAXB provider: URL_http://blog.bdoughan.com/2011/12/eclipselink-moxy-is-jaxb - provider-in.html.. details
      • This best mechanisms for this are: EclipseLink Forum: URL_http://www.eclipse.org/forums/index.php?t=thread&frm_id=111 [ URL_http://www.eclipse.org/forums/index.php?t=thread&frm_id=111 ] EclipseLink Users Mailing List: eclipselink-users AT eclipse.org** Enter a Bug: URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink [ URL_https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink ] For More Information** URL_http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html [ URL_http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html ] UPDATE Thanks for the answer although I'm not convinced requiring me to add element to prop order just because I want to rename it is an improvement.. details
      • For More Information** URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider_15.html [MOXy-as-Your-JAX-RS-JSON-Provider---Client-Side] URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider.html [MOXy-as-Your-JAX-RS-JSON-Provider---Server-Side] URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [Specifying-EclipseLink-MOXy-as-Your-JAXB-Provider] UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON-binding provider used by Jersey: URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html [ URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html ] .. details
  • Onlysentiment: 1
    1. general: 1
      • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.. details
  • Performance: 1
    1. general: 1
      • Why is it using array indicators "[]", while bird, cat, and dog are not arrays?Second, is there a way to get rid of "bird", "cat", and "dog"?. details
  • Bug: 10
    1. jaxb: 1
      • The exception being thrown is an RI exception (com.sun.xml.internal.bind.v2.runtime package) so EclipseLink MOXy is not being picked up as the JAXB provider.. details
    2. exception: 4
      • Exception in thread "main" javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json.. details
      • I receive this exception because of the following line of code: CODESNIPPET_JAVA1 .. details
      • I can fix it my modifying my DiscList.java class and adding to propOrder as suggested by the exception i.e from CODESNIPPET_JAVA3 .. details
      • I get the following exception CODESNIPPET_JAVA5 .. details
    3. json: 1
      • I am getting the below exception when the JSON string contains the '\' character.. details
    4. general: 4
      • Thankyou that was the problem.. details
      • I downloaded and tried it with 2.4.0-M18, but I'm still getting the same exception.. details
      • But when I rebuilt it today tests started to fail withe error CODESNIPPET_JAVA1 .. details
      • I think i understand the problem.. details
  • Usability: 28
    1. exception: 3
      • I receive this exception because of the following line of code: CODESNIPPET_JAVA1 .. details
      • Exception in thread "main" javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json.. details
      • I can fix it my modifying my DiscList.java class and adding to propOrder as suggested by the exception i.e from CODESNIPPET_JAVA3 .. details
    2. format: 1
      • I also needed to use an CODETERM7 for the CODETERM8 property as the format you are using doesn't match MOXy's default representation.. details
    3. jaxb: 5
      • The exception being thrown is an RI exception (com.sun.xml.internal.bind.v2.runtime package) so EclipseLink MOXy is not being picked up as the JAXB provider.. details
      • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA2 .. details
      • jaxb.properties To specify MOXy as your JAXB provider you need to include a file called CODETERM1 in the same package as your domain model with the following entry (see: URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as- your.html [ URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as - your.html] ): CODESNIPPET_JAVA3 .. details
      • For More Information** URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider_15.html [MOXy-as-Your-JAX-RS-JSON-Provider---Client-Side] URL_http://blog.bdoughan.com/2012/03/moxy-as-your-jax-rs-json-provider.html [MOXy-as-Your-JAX-RS-JSON-Provider---Server-Side] URL_http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html [Specifying-EclipseLink-MOXy-as-Your-JAXB-Provider] UPDATE In GlassFish 4 EclipseLink JAXB (MOXy) is the default JSON-binding provider used by Jersey: URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html [ URL_http://blog.bdoughan.com/2013/06/moxy-is-new-default-json-binding.html ] .. details
      • Someone suggested a way to solve my problem (in URL_http://stackoverflow.com/questions/5881058/how-to-map-a-bean-structure-to-a -different-schema-with-jax-rs), although it requires using Eclipselink Moxy, which I don't want to introduce (additional dependency and jaxb replacement in whole application).. details
    4. mapping: 1
      • On a side note, I'm also not able to use the new XmlVariableNode in Eclipselink 2.6 as I'm only allowed to use stable releases of the API :( CODETERM1 has also been included in EclipseLink 2.5.1 which is now released: URL_http://www.eclipse.org/eclipselink/downloads/ [ URL_http://www.eclipse.org/eclipselink/downloads/ ] This annotation is well suited for mapping your use case: URL_http://blog.bdoughan.com/2013/06/moxys-xmlvariablenode-using-maps-key-as.html [ URL_http://blog.bdoughan.com/2013/06/moxys-xmlvariablenode-using-maps-key-as.html ] .. details
    5. response: 1
      • Thanks for quick response I am facing javax.xml.bind.JAXBException: property "eclipselink.media-type" is not supported exception.. details
    6. json: 4
      • @Oleksi - The JSON binding is being added to 2.4.0, instead of a snap shot you can use a milestone 2.4.0-M18 URL_http://www.eclipse.org/eclipselink/downloads/milestones.php .. details
      • but then my resultant json is incorrect (because I need to rename count to disc-count).. details
      • Because the Relation-List element contains both relation elements and a target-type attribute a straight conversion to json requires the relation-list element to enscapulate the two elements, i.e I think if the Relation-List element did not have a target-type attribute in the model it would work no problem.. details
      • To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2.1.12).. details
    7. general: 11
      • Ah, thankyou sorry I thought you were just reiterating the answer to my other question URL_http://stackoverflow.com/questions/16931910/with-eclipselink-moxy - how-do-i-map-xml-content-to-a-name-different-to-value and because I used the alternative solution you gave I didnt see the need for it.I don't fully understand this but its now working :).. details
      • Unfortunately, I'm unable to unmarshal to MyObject in reverse due to the usage of XmlPath to collapse the outer meta element.. details
      • The actual model is a little more complex then Ive posted but the additional elements dont seem relevant to the issue.. details
      • Setting the type to be CODETERM2 will force a type qualified to be written out.. details
      • Thankyou that was the problem.. details
      • In short, I've grep'd and jar tf'd all the source code and JAR files in EclipseLink for this symbol to no avail so far.. details
      • Also, as noted, project restrictions make it difficult to walk the whole framework route.. details
      • Why is it using array indicators "[]", while bird, cat, and dog are not arrays?Second, is there a way to get rid of "bird", "cat", and "dog"?. details
      • I downloaded and tried it with 2.4.0-M18, but I'm still getting the same exception.. details
      • But when I rebuilt it today tests started to fail withe error CODESNIPPET_JAVA1 .. details
      • So the question really is what has changed in MOXy, and has this change introduced a bug ?. details
    8. properties: 1
      • Using EclipseLink MOXy, you can add properties to manipulate the output.. details
    9. schema: 1
      • but that is a pain because these classes are generated automatically from a schema, I don't want to have to manually edit them every time the schema changes.. details