Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Morphia update method is ambiguous

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?

like image 777
theShadow89 Avatar asked Aug 30 '26 10:08

theShadow89


1 Answers

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.

like image 170
SerhatCan Avatar answered Sep 01 '26 14:09

SerhatCan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!