When I try to update an entry in hibernate using this method in my DAOimpl
class:
public void setVoiceMailUnread(int id) {
Session session = sessionFactory.openSession();
Transaction transaction = null;
VoiceMail vm = (VoiceMail)session.load(VoiceMail.class, id);
try {
transaction = session.beginTransaction();
vm.setRead(false);
transaction.commit();
} catch (HibernateException e) {
if (transaction != null)
transaction.rollback();
e.printStackTrace();
} finally {
session.close();
}
}
I receive the following error:
ERROR: ERROR: column "recording" is of type lo but expression is of type bigint
Hint: You will need to rewrite or cast the expression.
Position: 201
In my entity class the instance variable recording is of type Blob:
@Entity
@Table(name = "VOICEMESSAGES")
public class VoiceMail implements Serializable {
private int uniqueId;
private int messageNumber;
private String directory;
private String context;
private String macroContext;
private String callerId;
private String origTime;
private String duration;
private String flag;
private String mailboxUser;
private String mailboxContext;
private Blob recording;
private String label;
private Boolean read;
private String messageId;
.....
@Column(name = "RECORDING", unique = true, nullable = false)
@Lob
@JsonIgnore
public Blob getRecording() {
return recording;
}
public void setRecording(Blob recording) {
this.recording = recording;
}
Perhaps I am missing something related to anotations for large objects because the recording column in the db is of type "lo". Thank you for your answers!