Open ZZerog opened 4 years ago
Yes, by coincidence I ran into the same problem yesterday. My code assumed that generated values would only be int or long, which is obviously wrong. I need to redesign it.
There is a workaround: execute the insert or update as a query:
String sql = "insert into foo (bar) values ('bah') returning created";
Timestamp created = db.sql(sql).first(Timestamp.class);
The Postgres "returning" keyword returns a result set. You can do "returning *" to get all columns.
How catch
created timestamp NOT NULL DEFAULT NOW()
column with single pojo object?I tried
with result:
com.dieselpoint.norm.DbException: org.postgresql.util.PSQLException: Bad value for type long : 2020-03-30 22:46:54.724897
Thx