I have a requirement that I need to save different type of data (int, float, string) in one database table column. Presently, I have set the data type of column to BLOB.
Table in DB:
......... OBJECT_VALUE BLOBclass ModelObjectValue() {
public Object objectValue;
//Getters and Setters of objectValue
...
}
Database column OBJECT_VALUE
(Data Type Blob) is mapped to objectValue
(Data Type java.lang.Object) property in ModelObjectValue.java
.
Data in OBJECT_VALUE
is either int, float or string. I successfully get the data in objectValue
as java.lang.Object
. But I can't convert/cast it back to int, float or string.
I have already tried开发者_如何学Go casting object to Integer, Float or String class. But all did not worked.
Please guide me about this issue.
精彩评论