1 Reply Latest reply on Apr 4, 2012 10:41 AM by Bartosz Majsak

    Arquillian h2 Database Help

    Manolescu Sebastian Newbie

      Hello

       

       

      I have a problem whit the following problem, when I try to use the h2 database that runs in the memory when JBoss is starting but It does not work...I thought that the  @UsingScript("import.sql") was not used. In the h2 database does no let me to add new INSERT's

      like: INSERT INTO `mix` (`ID`, `DATE_CREATE`, `DATE_UPDATE`, `R`, `L`, `K`, `CT`, `NAME`, `OR`) VALUES (1,NULL,NULL,NULL,1,'MAKE','x,'y',z);

       

      Caused by: org.h2.jdbc.JdbcSQLException: Table "mix" not found; SQL statement:

       

      My question is why the problem appears when I use h2 database for arquillian and if I use another database it works.

       

      // Java code

       

       

      public class MakeServiceTest {

         

         private final String TEST_VALUE = "test";

          private final Date TEST_DATE = new Date();

          private final Long TEST_LONG = 3l;

       

          @Deployment

            public static WebArchive createTestArchive() {

               return      ShrinkWrap.create( WebArchive.class,"test.war").addPackages(true,"org.joda.time").addPackages(true, "javax.jcr").addClasses(com.src.mde.Gx.class,com.sda.dar.qeq.class).addPackage("org.slf4j").addPackage("org.slf4j.spi").addPackage("org.slf4j.helpers").addAsWebInfResource("test-persistence.xml", "classes/META-INF/persistence.xml").addAsWebInfResource("beans.xml", "META-INF/beans.xml");

          }

        

           @EJB

           private SaveingService saveingService;

       

         

          

          @BeforeTest

          @UsingScript("import.sql")

          public void setUp()

           {}

       

      @Test

      public void someTest(){

       

          

       

      }

       

      }

       

       

      //standalone.xml

       

                          <connection-url>

                              jdbc:h2:mem:mixtest;MODE=MySQL

                          </connection-url>

      <driver>

                              h2

                          </driver>

                          <security>

                              <user-name>

                                  sa

                              </user-name>

                              <password>

                                  sa

                              </password>

       

       

      <driver name="h2" module="com.h2database.h2">

                              <xa-datasource-class>

                                  org.h2.jdbcx.JdbcDataSource

                              </xa-datasource-class>

                          </driver>

       

       

       

       

      If anyone can help me please reply....also sorry for my poor english