You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
createtableproduct
(
id bigserialnot nullconstraint product_pk
primary key,
title varcharnot null,
created timestamp with time zone default now() not null,
updated timestamp with time zone,
cost double precision default 0not null,
categories bigint[],
picture varchar
);
There is a problem with categories field.
I want to insert Product object to database.
Running
I get org.sql2o.Sql2oException: Error in executeUpdate, ERROR: INSERT has more expressions than target columns, because the final query looks like insert into delivery.product (title, cost, categories) values (?, ?, ?,?) RETURNING *. One parameter of type List<Long> transformed to two positions in query!
The main question is: can we make Qyery.bind() work with List/Array parameters when insert?
The text was updated successfully, but these errors were encountered:
iamhook
changed the title
To to correctly insert with array (ex bigint[]) columns?
How to correctly insert with array (ex bigint[]) columns?
Jan 8, 2021
iamhook
changed the title
How to correctly insert with array (ex bigint[]) columns?
How to correctly insert with array type (ex bigint[]) columns?
Jan 8, 2021
In my case, I have a class Product and table product:
There is a problem with
categories
field.I want to insert
Product
object to database.Running
I get
org.sql2o.Sql2oException: Error in executeUpdate, ERROR: INSERT has more expressions than target columns
, because the final query looks likeinsert into delivery.product (title, cost, categories) values (?, ?, ?,?) RETURNING *
. One parameter of typeList<Long>
transformed to two positions in query!The solution I found is to use
But it is not good idea, I think.
The main question is: can we make Qyery.bind() work with List/Array parameters when
insert
?The text was updated successfully, but these errors were encountered: