I use Morphia to make update mongoDB data.
I have create somthing like this:
public UpdateResults<? extends BaseEntity> update(Query<? extends BaseEntity> query,UpdateOperations updateOp) throws WriteConcernException{
return datastore.update(query, updateOp);
}
When i run my application on eclipse i haven't any problem.
So when i run maven build i get this error:
reference to update is ambiguous, both method <T>update(T,org.mongodb.morphia.query.UpdateOperations<T>) in org.mongodb.morphia.Datastore and method <T>update(org.mongodb.morphia.query.Query<T>,org.mongodb.morphia.query.UpdateOperations<T>) in org.mongodb.morphia.Datastore match
I effectively use the following method
<T>update(org.mongodb.morphia.query.Query<T>,org.mongodb.morphia.query.UpdateOperations<T>)
Why eclipse use correct method and maven not ? I can't understand.
How can i fix it for maven?
As a temporary solution you might use datastore.update(query, updateOp, false) instead of datastore.update(query, updateOp). It will pass createIfMissing parameter as false and it is already default behavior; so, it will not cause any problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With