It seem that JAX-WS
don't know how to convert the ObjectId
object to a String
. I don't know how you are using your documents, but I think that you can use a String
instead of an ObjectId
in your CompanyDoc
object. Spring data
will convert your String
to an ObjectId
when your inserting data and vice versa.
public class CompanyDoc{
@Id
private String id;
private String companyName;
//getter setter
}
More info from the documentation
The following outlines what type conversion, if any, will be done on the property mapped to the _id document field when using the MappingMongoConverter, the default for MongoTemplate.
- An id property or field declared as a String in the Java class will be converted to and stored as an ObjectId if possible using a Spring
Converter. Valid conversion rules are delegated to
the Mongo Java driver. If it cannot be converted to an ObjectId, then the value will be stored as a string in the database.- An id property or field declared as BigInteger in the Java class will be converted to and stored as an ObjectId using a Spring
Converter.