Hi, i'm sorry for my bad english

i want tu use a LISTAGG class here is the class content 

package packagetest;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.h2.api.AggregateFunction;
import com.google.common.base.Joiner;

public class ListAgg implements AggregateFunction
{

    private List<String> values = new ArrayList<String>();
    private String delimiter = "|";

    @Override
    public void init(Connection conn) throws SQLException
    {
    }

    @Override
    public int getType(int[] inputTypes) throws SQLException
    {
        if (inputTypes.length != 2) {
            throw new java.sql.SQLException("The aggregate function ListAgg 
must have 2 arguments.");
        }
        return java.sql.Types.VARCHAR;
    }

    @Override
    public void add(Object sqlValues) throws SQLException
    {
        Object[] objects = (Object[]) sqlValues;
        this.delimiter = (String) objects[1];
        String value = (String) objects[0];
        values.add(value);
    }

    @Override
    public Object getResult() throws SQLException
    {
        return Joiner.on(delimiter).join(values);
    }

}

So in my sql script i create an alias to this class 

CREATE ALIAS LISTAGG FOR "packagetest.ListAgg";


And i have this exception:

CREATE ALIAS LISTAGG FOR "packagetest.ListAgg"; nested exception is 
org.h2.jdbc.JdbcSQLException: Class "packagetest" not found; SQL statement:
Caused by: java.lang.ClassNotFoundException: packagetest

i dont now how to solve this

-- 
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