Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I define more than 2 XMLRootElement  RSS feed

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to web service. I am using JAX-WS and I am encountering problems regarding the cyclic references.

I have read the way to avoid this cyclic references problem is to define XMLRootElement and XML Transient using this link.

I am thinking if it is possible to define 2 XMLRootElement in this scenario.

Department has a one to many relationship bidirectional to Employee
I define XMLRootElement in Department and XML Transisent in Employee.

However, if I want to get the Employee.Department, then I was thinking if I can do this
Defining XMLRootElement in Employee and XMLTransient in Department.

In another words, the reason why I would need to define 2 XMLRootElement is because I want to use the get method using different class (i.e if I want to get department, I would call getDept(), if I want to use get employee, I would use getEmployee().)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!