I have to convert a bytea entry for a query to bigint. How could this be done?
More Info:
I have a hibernate repository as below -
@Query(value = "update Sample_Table set other_id = ?1 where id = ?2", nativeQuery = true)
void saveOrUpdateOtherId(Long other_id, Long id);
Hibernate somehow taking id (in where clause) as bytea and since 'Sample_Table' has this id field as bigint and thus it throws type mismatch problem.
I have tried using CAST to convert bytea to bigint but it didn't succeed and error msg says bytea can not be casted to bigint.
How can i change bytea to bigint?
Edit:
Sample_Table DAO:
@Table(name = "Sample_Table")
public class Sample{
@Id
@Column(name = "id", unique = true)
@GeneratedValue
private Long id;
@Column(name = "other_id")
private Long other_id;
}
id field is defined in here as Long.
Edit-2 If someone get such issue, most likely he is passing null value in the query.