NoSuchTableException

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

NoSuchTableException

Zhou, Yan
Hi there,

I am using DBUNIT 2.4.8 with Hypersonic database (in memory) and JPA 2.x (EclipseLink) to do a simple database unit test.

I am getting NoSuchTableException. Because this is in memory database, I do not have a way to see if the table is actually there.

My understanding is that, whenever entitymanager instance is created, the database tables are created in memory.  I pass in the connection from entity manager to do CLEAN_INSERT.  But it keeps giving me "NoSuchTableException" when it does DeleteAllOperation.

Here is related code and my persistence.xml.   What else could be done?

Thanks in advance,
Yan

    public void setUp() throws Exception {
        emf = Persistence.createEntityManagerFactory("mydatasource");
        em = emf.createEntityManager();   // em is an instance variable
        em.getTransaction().begin();                            

        DatabaseOperation.CLEAN_INSERT.execute(getDatabaseConnection(), getDataSet());
    }
   
    private IDatabaseConnection getDatabaseConnection() throws Exception {
        //  I am getting connection from entity manager here
        DatabaseConnection con = new DatabaseConnection(em.unwrap(java.sql.Connection.class), "public");
        con.getConfig().setFeature(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, Boolean.FALSE);
        return con;
    }
   
    protected IDataSet getDataSet() throws Exception
    {
        return new FlatXmlDataSetBuilder().build(new FileInputStream("provider.xml"));   // in my data file, there is only a few lines of Provider record.
    }
     


<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    <persistence-unit name="HubDataSourceForTest" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.medplus.certsuite.server.requestfactory.testcase.Provider</class>
        <properties>      
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
                <property name="eclipselink.ddl-generation.output-mode" value="database"/>
                <property name="eclipselink.target-database" value="HSQL"/>
       
                      <property name="eclipselink.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
                      <property name="eclipselink.jdbc.url" value="jdbc:hsqldb:mem:test"/>
                      <property name="eclipselink.jdbc.user" value="SA"/>
                      <property name="eclipselink.jdbc.password" value=""/>        
       
        <property name="eclipselink.target-server" value="WebLogic_10"/>
        <property name="eclipselink.logging.logger" value="DefaultLogger"/>
           

Thx!
Yan


org.dbunit.dataset.NoSuchTableException: PROVIDER
        at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:288)
        at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:109)
        at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
        at com.medplus.certsuite.server.requestfactory.testcase.ProviderTest.setUp(ProviderTest.java:45)
        at junit.framework.TestCase.runBare(TestCase.java:132)
        at junit.framework.TestResult$1.protect(TestResult.java:111)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:125)
        at junit.framework.TestSuite.runTest(TestSuite.java:233)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:684)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)





Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email ([hidden email]). After replying, please erase it from your computer system.

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user