PostgresqlDataTypeFactory does not recognizes enum list

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PostgresqlDataTypeFactory does not recognizes enum list

Alfonso Izquierdo
Dear all,

I'm using DBUnit for an integration test, and before executing the test code I'm running into this error:

badges.track_types data type (2003, '_text') not recognized and will be ignored. See FAQ for more information.

org.dbunit.dataset.NoSuchColumnException: badges.TRACK_TYPES -  (Non-uppercase input column: track_types) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.

the column that is ignored is a list of enums. In the dataset it's written like this : track_types="{TRACK_GENERIC}"

I looked in the DBUnit FAQ and saw the enum issue with postgres ( http://dbunit.sourceforge.net/faq.html#postgresqlEnumTypes ) , that says that I have to override the isEnumType() method to support my enum is Postgresql, so I did this:

/**
 * Override method to set custom properties/features
 */
protected void setUpDatabaseConfig(DatabaseConfig config) {

    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory(){
        public boolean isEnumType(String sqlTypeName) {
            if(sqlTypeName.equalsIgnoreCase("track_types")){
                return true;
            }
            return false;
        }
    });
    config.setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, new DefaultMetadataHandler());
}

But I still get the same error, and I don't know why. Maybe I'm not overriding well the method? Maybe it's not even the cause of my problem? If you need any other code just ask, thanks!

Al.

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user