ant test -Dtest.name=adapter
Write a class respecting this pattern for its name:
org.objectweb.jorm.rdb.adapter.<database name>Adapter
where <database name> is the name of your database and the first
letter is upper. This class should extend the BasicRdbAdapter class and
overide the methods which fail.
For example in postgres the BIGINT sql type does not exist. But the INT8
sql type must be used. Then the PostgresAdapter overides the method
getSqlType(PType, boolean, int, int) such as the following example:
package org.objectweb.jorm.mapper.rdb.adapter; import org.objectweb.jorm.api.PExceptionProtocol; import org.objectweb.jorm.api.PException; import org.objectweb.jorm.type.api.PType; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Connection; /** * Defines a RdbAdapter for the PostgreSQL database. */ public class PostgresAdapter extends BasicRdbAdapter { public PostgresAdapter() { super("postgres"); } public String getSqlType(PType pt, boolean usedInPK, int size, int scale) throws PExceptionProtocol { if (pt == null) { throw new PExceptionProtocol("No Sql Type name associated to a null PType"); } switch (pt.getTypeCode()) { case PType.TYPECODE_LONG: case PType.TYPECODE_OBJLONG: return "INT8"; default: return super.getSqlType(pt, usedInPK, size, scale); } } }We advice you to take a look on the existing RdbAdapter, and in the javadoc of the RdbAdapter interface.
ant test -Dtest.name=adapter
If you have questions about the RdbAdapter, contact the
JORM team.