2013-03-08 73 views
0

我有一個Spring-Data MongoDB存儲庫。這只是這樣的:在刪除期間,駱駝調用Spring-Data導致AmbiguousMethodCallException

public interface MyDataRepository extends PagingAndSortingRepository<MyData, String> {} 

我使用駱駝,和精美的作品保存:

.beanRef("myDataRepository","save") // saves myData from message body 

但刪除失敗。消息體是一個String,它是一個'myData'對象的id。這就是春告訴我(我格式化):

org.apache.camel.component.bean.AmbiguousMethodCallException: 
Ambiguous method invocations possible: [ 
    public final void $Proxy42.delete(java.io.Serializable), 
    public final void $Proxy42.delete(java.lang.Iterable), 
    public final void $Proxy42.delete(java.lang.Object)]. 
Exchange[Message: 513a3b6c0364f9195eca39ed] 

我試過這麼多的排列,我不知道該調用哪個了。 這裏有幾個簡單的:

.beanRef("myDataRepository","delete") 
.beanRef("myDataRepository","delete(String)") 

想法?

回答

0

那麼,我的解決方案一直在解決這個問題。

切換到使用:

.beanRef("myDataRepository", "findOne") // lookup based on id in msg body 
.beanRef("myDataRepository", "delete") // delete based on object 

所以現在我刪除使用對象本身,消除歧義。足夠好,但可以直接解決問題的其他答案。