Hello Jan, I have been able to reproduce your bug with SQL-Server but only by disabling Prepared Statements.
I have provided a fix that works for me on SQL Server. The fix requires the following SQL-Phrases in the corresponding DBMSHandler to be set correctly: case SQL_TIME_PATTERN: return "HH:mm:ss"; case SQL_TIME_TEMPLATE: return "convert(time, '{0}')"; The example is taken from the SQL-Server implementation (DBMSHandlerMSSQL). Please check. Regards Rainer P.S. Please consider creating a Jira ticket yourself next time. Thanks. -----Original Message ----- From: Jan Glaubitz <j...@glaubitz.org> To: dev@empire-db.apache.org Subject: Re: Problem inserting LocalTime to TIME Columns Can anyone confirm or deny this is a bug? Thanks, jan > Am 14.07.2023 um 09:51 schrieb Jan Glaubitz <j...@glaubitz.org>: > > Hi, > > I want to insert LocalTime objects into DataType.TIME-columns. > > Empire-db: > > [...] > this.ABFAHRT_PLAN = addColumn("ABFAHRT_PLAN", DataType.TIME, 0.0, > false); this.ABFAHRT_IST = addColumn("ABFAHRT_IST", DataType.TIME, > 0.0, false); [...] > > PostgreSQL: > > [...] > ABFAHRT_PLAN TIME, > ABFAHRT_IST TIME, > [...] > > but inserting throws an exception: > > org.apache.empire.exceptions.InvalidArgumentException: Invalid Argument 02:24 > for parameter value. > at > org.apache.empire.db.DBSQLBuilder.getDateTimeString(DBSQLBuilder.java: > 387) ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > at > org.apache.empire.db.DBSQLBuilder.appendSimpleValue(DBSQLBuilder.java: > 297) ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > at > org.apache.empire.db.DBSQLBuilder.appendValue(DBSQLBuilder.java:218) > ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > at org.apache.empire.db.expr.set.DBSetExpr.addSQL(DBSetExpr.java:143) > ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > at > org.apache.empire.db.DBCommandExpr.addListExpr(DBCommandExpr.java:669) > ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > at org.apache.empire.db.DBCommand.getInsert(DBCommand.java:1685) > ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > at > org.apache.empire.db.context.DBContextBase.executeInsert(DBContextBase > .java:115) ~[empire-db-3.1.1-SNAPSHOT.jar:3.1.1-SNAPSHOT] > > When I convert the LocalTime object to a Date object it works. > > Is LocalTime unsupported or is this a bug? > > Thanks, > > jan