I developed my project with spring data mongodb, and used to have this document:
@Document(collection="Instrument")
public class Instrument {
@Id
private Integer id;
private String name;
private String internalCode;
private String fosMarketId;
private String localCode;
//setters...getters... and constructurs....
Now I need to add some property to my document as bellow:
....
private Long from;
private Long to;
private Long OpenHourfrom;
private Long OpenHourTo;
private Boolean isActive;
//setters...getters... and constructurs....
so I have this new constructor:
@PersistenceConstructor
public Instrument(Integer id, String name, String internalCode, String fosMarketId, String localCode, Long from,
Long to, Long openHourfrom, Long openHourTo, Boolean isActive) {
super();
this.id = id;
this.name = name;
this.internalCode = internalCode;
this.fosMarketId = fosMarketId;
this.localCode = localCode;
this.from = from;
this.to = to;
this.OpenHourfrom = openHourfrom;
this.OpenHourTo = openHourTo;
this.isActive = isActive;
}
but when I run one of repo methods this exception had thrown:
org.springframework.data.mapping.model.MappingException: No property openHourfrom found on entity class com.tosan.entity.Instrument to bind constructor parameter to!
at org.springframework.data.mapping.model.PersistentEntityParameterValueProvider.getParameterValue(PersistentEntityParameterValueProvider.java:74)
at ....
Note that I use spring-confix.xml with bellow settings:
<mongo:mongo-client
host="IP" port="Port" >
<mongo:client-options write-concern="NORMAL"
connections-per-host="1000"
threads-allowed-to-block-for-connection-multiplier="600"
connect-timeout="10000"
max-wait-time="15000"
socket-keep-alive="true"
socket-timeout="15000"
/>
</mongo:mongo-client>
I wonder how can I set auto update property of hibernate spring to true, so that I could update my document and add new properties.