I am modelling, in a JPA framework, the situation of a user selling multiple articles to other users. I have three entities: User
, Article
and Order
. They have the following relationships:
User
has @OneToMany relationships withOrder
andArticle
, annotated @XmlTransient.Article
has a @ManyToOne relationship withUser
Order
has @ManyToOne relationships withUser
andArticle
Everything works right and I can succesfully persist these entities in my database. The problem is when I want to retrieve them from the server. The server sends me without problems objects of type User
and Article
, however it fails with an "Internal Server Error" when trying to send an object of type Order
(which is completely well formed before being sent).
I'm using GlassFish 4, implementing REST web services with JAX. There is no logging for these errors so I don't know where to start to look for a solution! I guess it might be a history of circular relations but I don't really see how it can be fixed.
Thanks for your help!