Morphia update method is ambiguous

I am using Morphia to update mongoDB data.

I created something 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 have no problem whatsoever.

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 am using the following method effectively

<T>update(org.mongodb.morphia.query.Query<T>,org.mongodb.morphia.query.UpdateOperations<T>) 

      

Why is eclipse using the correct method and maven not? I do not understand.

How can I fix this for maven?

+3


source to share


1 answer


As a workaround, you can use datastore.update(query, updateOp, false)

instead datastore.update(query, updateOp)

. It will pass the createIfMissing parameter as false , which is the default behavior; therefore, it will not cause any problems.



+1


source







All Articles