Hi,

I'm not sure why, but it looks like inner classes are not supported right
now. I get:


Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.h2.schema.TriggerObject.loadFromSource(TriggerObject.java:101)
    ... 15 more
Caused by: java.lang.NoClassDefFoundError:
org/h2/dynamic/trigger/MY_TRIGGER$Trig (wrong name:
org/h2/dynamic/trigger/MY_TRIGGER)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
    at
org.h2.util.SourceCompiler$ClassFileManager$1.findClass(SourceCompiler.java:520)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)



CREATE TRIGGER MY_TRIGGER BEFORE INSERT ON MY_TABLE AS $$
       org.h2.api.Trigger create() {
        return new Trig();
    }
    static class Trig implements  org.h2.api.Trigger {
            @Override
            public void remove() throws SQLException {
            }
            @Override
            public void init(Connection conn, String schemaName, String
triggerName, String tableName, boolean before,
                int type) throws SQLException {
            }
            @Override
            public void fire(Connection conn, Object[] oldRow, Object[]
newRow) throws SQLException {
            }
            @Override
            public void close() throws SQLException {
            }
    }
     $$;

Regards,
Thomas

On Wed, Mar 22, 2017 at 12:43 PM, Giulio Vito de Musso <
giulio.vito.demu...@gmail.com> wrote:

> Hi Noel, thanks for the reply.
>
> This is the full stacktrace of the error
>
> SQL Error [90043] [90043]: Error creating or initializing trigger
> "MY_TRIGGER" object, class "..source..", cause: "org.h2.message.DbException:
> Syntax error in SQL statement ""
>     org.h2.api.Trigger create() {
>         return new org.h2.api.Trigger() {
>
>
>             @Override
>             public void remove() throws SQLException {
>             }
>
>
>             @Override
>             public void init(Connection conn, String schemaName, String
> triggerName, String tableName, boolean before,
>                 int type) throws SQLException {
>             }
>
>
>             @Override
>             public void fire(Connection conn, Object[] oldRow, Object[]
> newRow) throws SQLException {
>             }
>
>
>             @Override
>             public void close() throws SQLException {
>             }
>         };
>
>
>     } "" [42000-193]"; see root cause for details; SQL statement:
> CREATE TRIGGER MY_TRIGGER BEFORE INSERT ON CURRENT_APPLICATION_PROPERTY AS
> $$
>     org.h2.api.Trigger create() {
>         return new org.h2.api.Trigger() {
>
>
>             @Override
>             public void remove() throws SQLException {
>             }
>
>
>             @Override
>             public void init(Connection conn, String schemaName, String
> triggerName, String tableName, boolean before,
>                 int type) throws SQLException {
>             }
>
>
>             @Override
>             public void fire(Connection conn, Object[] oldRow, Object[]
> newRow) throws SQLException {
>             }
>
>
>             @Override
>             public void close() throws SQLException {
>             }
>         };
>
>
>     } $$ [90043-193]
>   Error creating or initializing trigger "MY_TRIGGER" object, class
> "..source..", cause: "org.h2.message.DbException: Syntax error in SQL
> statement ""
>     org.h2.api.Trigger create() {
>         return new org.h2.api.Trigger() {
>
>
>             @Override
>             public void remove() throws SQLException {
>             }
>
>
>             @Override
>             public void init(Connection conn, String schemaName, String
> triggerName, String tableName, boolean before,
>                 int type) throws SQLException {
>             }
>
>
>             @Override
>             public void fire(Connection conn, Object[] oldRow, Object[]
> newRow) throws SQLException {
>             }
>
>
>             @Override
>             public void close() throws SQLException {
>             }
>         };
>
>
>     } "" [42000-193]"; see root cause for details; SQL statement:
> CREATE TRIGGER MY_TRIGGER BEFORE INSERT ON CURRENT_APPLICATION_PROPERTY AS
> $$
>     org.h2.api.Trigger create() {
>         return new org.h2.api.Trigger() {
>
>
>             @Override
>             public void remove() throws SQLException {
>             }
>
>
>             @Override
>             public void init(Connection conn, String schemaName, String
> triggerName, String tableName, boolean before,
>                 int type) throws SQLException {
>             }
>
>
>             @Override
>             public void fire(Connection conn, Object[] oldRow, Object[]
> newRow) throws SQLException {
>             }
>
>
>             @Override
>             public void close() throws SQLException {
>             }
>         };
>
>
>     } $$ [90043-193]
>     Syntax error in SQL statement "
>     org.h2.api.Trigger create() {
>         return new org.h2.api.Trigger() {
>
>
>             @Override
>             public void remove() throws SQLException {
>             }
>
>
>             @Override
>             public void init(Connection conn, String schemaName, String
> triggerName, String tableName, boolean before,
>                 int type) throws SQLException {
>             }
>
>
>             @Override
>             public void fire(Connection conn, Object[] oldRow, Object[]
> newRow) throws SQLException {
>             }
>
>
>             @Override
>             public void close() throws SQLException {
>             }
>         };
>
>
>     } " [42000-193]
>       Syntax error in SQL statement "
>     org.h2.api.Trigger create() {
>         return new org.h2.api.Trigger() {
>
>
>             @Override
>             public void remove() throws SQLException {
>             }
>
>
>             @Override
>             public void init(Connection conn, String schemaName, String
> triggerName, String tableName, boolean before,
>                 int type) throws SQLException {
>             }
>
>
>             @Override
>             public void fire(Connection conn, Object[] oldRow, Object[]
> newRow) throws SQLException {
>             }
>
>
>             @Override
>             public void close() throws SQLException {
>             }
>         };
>
>
>     } " [42000-193]
>
>           java.lang.NullPointerException:
>
>
>
>
>
> Il giorno mercoledì 22 marzo 2017 12:13:34 UTC+1, Noel Grandin ha scritto:
>>
>> what does the rest of the exception trace look like?
>>
>> --
> 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 h2-database+unsubscr...@googlegroups.com.
> To post to this group, send email to h2-database@googlegroups.com.
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to