2016-11-23 48 views
0

在我的PostgreSQL的數據庫,我有一個字段的數據類型int[]試圖MAPP這一個Grails領域類列Integer[]的應用程序無法啓動:映射PostgreSQL的INETGER []數據類型中的Grails

org.hibernate.type.SerializationException: could not deserialize 

是有沒有其他的方法來實現這一目標?

我也嘗試這樣的://insurance column: 'rs_insurance', sqlType: "integer[]"

回答

0

byte[]類型工作外的框和被映射到相應的BLOB型。

如果不是罰款,你可以在保存您的序列化陣列和反序列化在加載:從DB

void setValue(v) { 
    ByteArrayOutputStream baos = new ByteArrayOutputStream() 
    baos.withObjectOutputStream{ it.writeObject v } 
    blob = baos.toByteArray() 
} 

def getValue() { 
    def out = null 
    if(blob) new ByteArrayInputStream(blob).withObjectInputStream{ out = it.readObject() } 
    out 
} 
+0

值(57,58,59,60)轉化成這些值[123, 53,55,44,53,56,44,53,57,44,54,48,125] – Jacob

+0

你做了什麼?什麼SQL類型是你的列? – injecteer

+0

列是類型整數[]和值是{57,58,59,60} – Jacob