Dear Spring Community,
I am pleased to announce the availability of Spring Data MongoDB 1.0.0 M4. Here are the most important features added:
Beyond that we ship a ton of bug fixes and improvements mostly around the mapping subsystem and performance. For a detailed list of tickets fixed have a look at the changelog.
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"3.sudo apt-get update4.sudo apt-get install sun-java6-jre sun-java6-plugin
The elements to be marshalled must be public, or have the XMLElement anotation. The ArrayList class and your class Books do not match any of these rules. You have to define a method to offer the Book values, and anotate it.
On your code, changing only your Books class adding a "self getter" method:
@XmlRootElement
@XmlSeeAlso({Book.class})
public class Books extends ArrayList<Book> {
public Books() {
this.add(new Book("The Sign of the Four"));
}
@XmlElement(name = "book")
public List<Book> getBooks() {
return this;
}
}
when you run your marshalling code you'll get:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<books><book><title>The Sign of the Four</title></book></books>