2

我試圖從ID搜索的數據庫獲取產品表中的項目列表。我在產品表中添加了UDT列。UDT錯誤 - pageCount不是在此UDT中定義的字段

try 
{ 
    final List<Row> rows = session.execute(boundStatement.bind(pId, pmyTime)).all(); 
    if (!rows.isEmpty()) 
    { 
    productDataList = ProductMapper.extractResult(rows, myBomObjMapper); 
    } 
} 

在初始化方法 -

public void init(){ 

     session = cassandraSessionFactory.getSession(); 
     myObjMapper = new MappingManager(session).udtMapper(BomObject.class); 

}

我得到一個異常

 java.lang.IllegalArgumentException: pageCount is not a field defined in this UDT 

我到底做錯了什麼?

+0

我們需要更多信息才能夠幫助您。你的模式是什麼?你是如何定義UDT的? mapper是怎樣的? –

回答

0

我在產品表中添加了UDT列。

你加列作爲ALTER TYPE CQL命令調用?:

myObjMapper = new MappingManager(session).udtMapper(BomObject.class); 

後,如果這是很可能發生的事情是,你UDTMapper有一個陳舊的參照UserType的情況下代表您在構建映射器時的UDT。它看起來不像datastax驅動程序將更新此引用。我看到一張帶有類似錯誤信息的傑拉票(JAVA-1126)。我會對該票發表評論,詢問這是否應該得到支持。