on 10-06-2008 2:04 PM
@Entity
@Table(name = "OBJECTCATEGORY")
public class ObjectCategory implements Serializable {
@Id
private String categoryId;
private String categoryName;
private String description;
private static final long serialVersionUID = 1L;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "MAP_CATEGORY", joinColumns = @JoinColumn(name = "CATEGORYID"), inverseJoinColumns = @JoinColumn(name = "OBJECTID"))
private List<MapC> mapList = new ArrayList<MapC>();
// Recursion
@OneToMany(fetch = FetchType.LAZY, mappedBy = "fqQuesCatagory")
List<ObjectCategory > categoryList = new ArrayList<ObjectCategory>();
@ManyToOne
@JoinColumn(name = "PARENTCATEGORY")
private ObjectCategory fqQuesCatagory
// Recursion
public FqQuesCatagory() {
super();
}
public String getCategoryname() {
return this.categoryname;
}
public void setCategoryname(String categoryname) {
this.categoryname = categoryname;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public List<MapC> getMapList() {
return faqList;
}
public void setFaqList(List<MapC> faqList) {
this.mapList = mapList ;
}
public String getCategoryid() {
return categoryId;
}
public void setCategoryid(String categoryid) {
this.categoryid = categoryId;
}
public List<ObjectCategory> getFqCategoryList() {
return categoryList;
}
public void setFqCategoryList(List<ObjectCategory> categoryList) {
this.categoryList = categoryList;
}
public ObjectCategory getFqQuesCatagory() {
return fqQuesCatagory;
}
public void setFqQuesCatagory(ObjectCategory fqQuesCatagory) {
this.fqQuesCatagory = fqQuesCatagory;
}
}
Doesn't SAP JPA support recursive parent-child relationship (highlighted by "// Recursion"). The same model works in TopLink perfectly.
You have a very strange constructor - FqQuesCatagory() - for the class ObjectCategory?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the delayed update..
I see an issue in the WSNavigator. I have a method in my EJB exposed as a web service. This method has a single argument, which is a serializable class containing a few string variables and the above-mentioned Entity with suitable getters and setters for all the class variables.
When I try to select this operation under the WSDL in the Webservice Navigator, I get a stack overflow error. I think it is because WD4J run-time is not able to build the nested tree. Not sure though...I've attached the stack trace below:
Cannot send an HTTP error response [500 "Application error occurred during the request procession." (details: java.lang.StackOverflowError
at java.lang.String.lastIndexOf(String.java:1496)
at java.lang.String.lastIndexOf(String.java:1458)
at com.sap.dictionary.runtime.StringUtil.getPackageName(StringUtil.java:143)
at com.sap.dictionary.runtime.DdBroker.getDataType(DdBroker.java:179)
at com.sap.tc.webdynpro.progmodel.context.DictionaryHandler._getScalarType(DictionaryHandler.java:447)
at com.sap.tc.webdynpro.progmodel.context.DictionaryHandler.getDataType(DictionaryHandler.java:159)
at com.sap.tc.webdynpro.progmodel.context.DataAttributeInfo.init(DataAttributeInfo.java:447)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.addAttribute(NodeInfo.java:746)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.addAttribute(NodeInfo.java:759)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder.createParameterNodeInfo(DWSContextBuilder.java:984)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder.access$400(DWSContextBuilder.java:88)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1591)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
Any thoughts on this will be highly appreciated.
BR.
Hi Bala,
This should be caused by the bidirectional OneToMany recursive relationship in your entity class. The WS framework tries to serialize all fields and obviously gets into a cycle.
You can work around this by applying the javax.xml.bind.annotation.XmlTransient annotation to the corresponding getter methods.
HTH!
\-- Vladimir
Refer the note mentioned by Angel above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the mapping looks fine. It should work.
If you are observing an issue with it, just let us know.
-Adrian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.