Tuesday, September 25, 2018

Hibernate - @Lob with PostgreSQL

In Java, if you declare

@Column(name = "Remark")
protected String Remark;

Hibernate will generate the column as Text data type.

CREATE TABLE public.sometable
    id integer NOT NULL DEFAULT ,
    remark text COLLATE pg_catalog."default",

Everything is good so far, however, when you query the database with select statement (e.g select * from sometable), it will show

In my test case, all remark column are empty string. So, what are those numbers? These numbers are the UID of the LOB for each remark. In order to view the original text, one may need to run

select id, convert_from(loread(
      lo_open(remark::int, x'40000'::int), x'40000'::int), 'UTF-8')
  AS remark from mission

PuTTY - Keeping session alive

If you have some VPN tunnels that timeout based on activity, you could try the following setting if you are using PuTTY 1) Open PuTTY and...