我有一堂课:
@Table(name = "Control")
public class Control extends Model{
@Column
private String name;
[...]
@Column
private Map<String, Object> properties;
}
我在这门课上有其他领域,但我在这里只写了那些足以说明我的问题的领域。
我有一个关于插入的例外:
09-14 22:11:34.542: E/SQLiteLog(11482): (1) table Control has no column named properties
对象可以是 String[] 或 String。
如果我不将 @Column 放在 HashMap 数据上,那么一切都“正常”,只有它们没有存储的问题。
所以我的问题是我应该如何解决存储这个哈希图。
我的数据来自 API,并且它始终具有不同的属性:
controls: [
{
bundle: "CloseButton",
frame: "0,0,25,25"
},
{
referenceKey: "AccelerationGyro",
name: "Acceleration Sensor",
bundle: "Gyro",
properties: {
axis: "Z"
observedKey: "brakeState",
requiedValue: "1"
},
channels: {
CH: "Acceleration"
}
},
{
referenceKey: "SteeringGyro",
name: "Steering Sensor",
bundle: "Gyro",
properties: {
axis: "Y"
allowedOnI: [
"@Lights",
"@Rack",
"@ReversingLamp"
],
},
channels: {
CH: "Steering"
}
},
我想使用 ActiveAndroid lib 来存储这个类。但不幸的是,我在网上找不到任何解决方案。
我不确定我的问题是否清楚,如果需要,我可以提供额外的东西。我也只想存储 HashMap。:P 它是否可能以某种方式连接到 TypeSerializers?
提前感谢您的回答。