In 4.1.RC2, how to contribute/replace PKGenerator

Juan Manuel Diaz Lara <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
My DB is postgres, how can I contribute/replace de PostgresPkGenerator with my own implementation to genera UUID's as PK's:
public class PcExpressPosUUIDPkGenerator extends PostgresPkGenerator {
    public PcExpressPosUUIDPkGenerator(@Inject PostgresAdapter adapter) {
        super(adapter);
    }

    @Override
    public Object generatePk(DataNode arg0, DbAttribute attribute) throws Exception {
        if (    attribute.getType() == java.sql.Types.OTHER)
            return java.util.UUID.randomUUID();
        else if (attribute.getType() == java.sql.Types.VARCHAR)
            return java.util.UUID.randomUUID().toString();
        else 
            return super.generatePk(arg0, attribute);
    }
}
I tryied this in a new Module:

ServerModule.contributePkGenerators(binder).put(PostgresAdapter.class.getName(), PcExpressPosUUIDPkGenerator.class);
But when trying to create my first context get this error:
org.apache.cayenne.di.DIRuntimeException: DI container has no binding for key <BindingKey: org.apache.cayenne.dba.postgres.PostgresAdapter>

Atte. Juan Manuel Díaz Lara
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.