database - DBunit can't find tables defined on dataset -
i have dataset (defined in xml) , using postgresql, pojos annotated jpa, , dbunit junit tests.
when test runs, creates tables , sequences in database, when starts read dataset (xml) table definitions , columns, fires following error org.dbunit.dataset.nosuchtableexception "nameoftable" tried put name of table caps , normal caps, , won't work. table created in public schema, , tried define in xml table public."nameoftable" won't work.... ideas?
i tried run tests dunit in following versions: 2.2.2, 2.3.0, , 2.4.5.
thanks.
with dbunit can either use specific schema test against, or full database (with potentially multiple schema). if use latter need specify schema in dataset when importing/exporting or can confused; in postgresql @ least, i've not tried else.
to enforce add following code in:
if (strschema == null || strschema.isempty()) { conn = new databaseconnection(jdbcconnection); conn.getconfig().setproperty( "http://www.dbunit.org/features/qualifiedtablenames", true); } else conn = new databaseconnection(jdbcconnection, strschema);
the important bit setting of property; rest use make connection relevant db or schema (based upon schema name extracted hibernate config xml).
Comments
Post a Comment