Sunday, January 29, 2017

H2 - How to make user function

I've made user function for H2.
But It didn't work as blow.
29 Jan 2017;05:25:30.778 [1719132627@qtp-715211920-0] ERROR c.a.c.c.AbstractBaseController.handleException(289) - Exception's trace:
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Function "LAST_INSERT_ID_MAX" not found; SQL statement:
UPDATE
abilists_sequence
SET
id=LAST_INSERT_ID_MAX(id+1)
WHERE
seq_name = ? [90022-191]

What cause the error is public in java.
This is the error code.
CREATE ALIAS LAST_INSERT_ID_MAX AS '

@CODE
public int lastInsertIdMax(int id) throws Exception {
return id;
}
';

What cause the error is public in java.
This is the solved code.
CREATE ALIAS LAST_INSERT_ID_MAX AS '

@CODE
int lastInsertIdMax(int id) throws Exception {
return id;
}
';

No comments:

Post a Comment