My mistake. This was caused by user error.

There were two classes named Permission and the one I was pointing to the 
wrong one. The 3rd parameter was of type Object which gets translated into 
byte[], hence this error message.

Gili

On Sunday, October 5, 2014 1:27:39 AM UTC-4, Gili wrote:
>
> Hi,
>
> I am invoking this code under H2 1.4.181:
>
> CREATE ALIAS permission_log FOR 
> "com.vtlr.backend.database.permission.Permission.log";
> CALL permission_log(@administrators_permission_id, 'owned by administrator 
> role', 5);
>
> and I get this exception:
>
> org.h2.jdbc.JdbcSQLException: Hexadecimal string with odd number of 
> characters: "5"; SQL statement:
> CALL permission_log(@administrators_permission_id, 'owned by administrator 
> role', 5) [90003-181]
> at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
> at org.h2.message.DbException.get(DbException.java:179)
> at org.h2.message.DbException.get(DbException.java:155)
> at org.h2.util.StringUtils.convertHexToBytes(StringUtils.java:950)
> at org.h2.value.Value.convertTo(Value.java:867)
> at org.h2.engine.FunctionAlias$JavaMethod.getValue(FunctionAlias.java:443)
> at org.h2.expression.JavaFunction.getValue(JavaFunction.java:38)
> at org.h2.command.dml.Call.query(Call.java:65)
> at org.h2.command.CommandContainer.query(CommandContainer.java:90)
> at org.h2.command.Command.executeQuery(Command.java:197)
> at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:180)
> at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:159)
> at 
> org.flywaydb.core.internal.dbsupport.JdbcTemplate.executeStatement(JdbcTemplate.java:235)
> at 
> org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:89)
> at 
> org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:73)
> at 
> org.flywaydb.core.internal.command.DbMigrate$5.doInTransaction(DbMigrate.java:287)
> at 
> org.flywaydb.core.internal.command.DbMigrate$5.doInTransaction(DbMigrate.java:285)
> at 
> org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
> at 
> org.flywaydb.core.internal.command.DbMigrate.applyMigration(DbMigrate.java:285)
> at 
> org.flywaydb.core.internal.command.DbMigrate.access$800(DbMigrate.java:46)
> at 
> org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:207)
> at 
> org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:156)
> at 
> org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
> at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:156)
> at org.flywaydb.core.Flyway$1.execute(Flyway.java:864)
> at org.flywaydb.core.Flyway$1.execute(Flyway.java:811)
> at org.flywaydb.core.Flyway.execute(Flyway.java:1171)
> at org.flywaydb.core.Flyway.migrate(Flyway.java:811)
> at org.flywaydb.maven.MigrateMojo.doExecute(MigrateMojo.java:33)
> at 
> org.flywaydb.maven.AbstractFlywayMojo.execute(AbstractFlywayMojo.java:454)
> ... 21 more
>
> I understand that H2 is trying to convert the number to a byte[], but I 
> don't understand why.
>
> The user function has this prototype:
>
>    public static void log(short permissionId, String action, long 
> dependentId)
>
> What is the correct way to pass a long into a user function without it 
> getting confused for a byte[]?
>
> Thanks,
> Gili
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to