Hey guys,
I wanna make the same yabe project but with Siena, I'm now at second
page:
http://www.playframework.org/documentation/1.2.3/guide2
and trying to make a relation with Post and Comment models
I didnt put any @ManyToOne annotations like in example and getting
this error:
useTheCommentsRelation A java.lang.IllegalArgumentException has been
caught, Unsupported type: models.Comment
In /test/BasicTest.java, line 115 :
almasPost.addComment("Jeff", "Nice post");
Hide trace
java.lang.IllegalArgumentException: Unsupported type: models.Comment
at siena.Json.(Json.java:102)
at siena.embed.JsonSerializer.serialize(JsonSerializer.java:103)
at siena.embed.JsonSerializer.serialize(JsonSerializer.java:27)
at siena.embed.JsonSerializer.serialize(JsonSerializer.java:52)
at siena.embed.JsonSerializer.serialize(JsonSerializer.java:27)
at siena.gae.GaeMappingUtils.fillEntity(GaeMappingUtils.java:412)
at
siena.gae.GaePersistenceManager._updateSimple(GaePersistenceManager.java:
556)
at siena.gae.GaePersistenceManager.update(GaePersistenceManager.java:
513)
at siena.Model.update(Model.java:83)
at models.Post.addComment(Post.java:39)
at BasicTest.useTheCommentsRelation(BasicTest.java:115)
......
But in example it says that if I delete Post then system automatically
deletes all Comments related to this Post,
Here is the original JPA example
@OneToMany(mappedBy="post", cascade=CascadeType.ALL)
public List<Comment> comments;
public Post(User author, String title, String content) {
this.comments = new ArrayList<Comment>();
this.author = author;
this.title = title;
this.content = content;
this.postedAt = new Date();
}
public Post addComment(String author, String content) {
Comment newComment = new Comment(this, author, content).save();
this.comments.add(newComment);
this.save();
return this;
}
I'm getting error when I try to add comment to existing post.
Any idea?
Regards,
Almas
On Oct 19, 2:37 pm, Pascal Voitot Dev <
pascal.voitot....@gmail.com>
wrote:
> Go there:
http://www.sienaproject.com/index.html
> Then :
https://github.com/mandubian/siena/blob/master/source/documentation/m...
> Then :
https://github.com/mandubian/siena/wiki/Manuals
> This one is about queries:
https://github.com/mandubian/siena/blob/master/source/documentation/m...
>
> after that, we have some special features around aggregation/embedding
> linked to NoSQL features and the new syntaxes One<T>/Many<T> providing
> syntactic sugar for One2Many relations.
>
> regards
> Pascal
>