mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Change blob read method
This commit is contained in:
parent
45d6c08773
commit
749f2b782e
@ -133,7 +133,7 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
ByteArrayInputStream bais;
|
ByteArrayInputStream bais;
|
||||||
ObjectInputStream ois;
|
ObjectOutputStream objectOutputStream;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Connection connection = OperationManagementDAOFactory.openConnection();
|
Connection connection = OperationManagementDAOFactory.openConnection();
|
||||||
@ -149,13 +149,21 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|||||||
stmt.setString(2, deviceId.getId());
|
stmt.setString(2, deviceId.getId());
|
||||||
rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
byte[] operationObjbyteArr = new byte[0];
|
byte[] operationObjbyteArr;
|
||||||
|
Blob operationBlob;
|
||||||
|
ByteArrayInputStream in;
|
||||||
|
ObjectInputStream is;
|
||||||
|
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
operationObjbyteArr = rs.getBytes("OPERATIONDETAILS");
|
operationBlob = rs.getBlob("OPERATIONDETAILS");
|
||||||
|
operationObjbyteArr = operationBlob.getBytes(1, (int) operationBlob.length());
|
||||||
|
in = new ByteArrayInputStream(operationObjbyteArr);
|
||||||
|
is = new ObjectInputStream(in);
|
||||||
|
return (ProfileOperation) is.readObject();
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
bais = new ByteArrayInputStream(operationObjbyteArr);
|
|
||||||
ois = new ObjectInputStream(bais);
|
|
||||||
return (ProfileOperation) ois.readObject();
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("SQL error occurred while retrieving profile operation", e);
|
log.error("SQL error occurred while retrieving profile operation", e);
|
||||||
throw new OperationManagementDAOException("Error occurred while adding operation metadata", e);
|
throw new OperationManagementDAOException("Error occurred while adding operation metadata", e);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user