Search code examples
javajpajbossh2

H2 Console can not see tables created by hibernate


enter image description hereI have a JEE web project that uses JPA und should run on JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8). I want to test the project with the in-memory database H2. I deploy my application I see the following on the console:

13:55:18,587 INFO  [stdout] (ServerService Thread Pool -- 87) Hibernate: create table seatforshow (id integer not null, isFree boolean not null, price decimal(19,2), rowNo tinyint not null, seatNo tinyint not null, filmShow_id integer not null, primary key (id))

13:55:18,588 INFO  [stdout] (ServerService Thread Pool -- 87) Hibernate: alter table filmshow add constraint FKD4A76E8171BAB7DF foreign key (cinema_id) references cinema

13:55:18,591 INFO  [stdout] (ServerService Thread Pool -- 87) Hibernate: alter table filmshow add constraint FKD4A76E81D7BB783F foreign key (film_id) references film

13:55:18,593 INFO  [stdout] (ServerService Thread Pool -- 87) Hibernate: alter table seat add constraint FK35CE0571BAB7DF foreign key (cinema_id) references cinema

13:55:18,595 INFO  [stdout] (ServerService Thread Pool -- 87) Hibernate: alter table seatforshow add constraint FK5B4E2DA141F8E4BF foreign key (filmShow_id) references filmshow

13:55:18,597 INFO  [stdout] (ServerService Thread Pool -- 87) Hibernate: create sequence hibernate_sequence start with 1 increment by 1

13:55:18,598 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 87) HHH000230: Schema export complete

However, after I open

localhost:8080/h2-console/console/

I do not see my tables there. I suppose that I might need to provide the schema name (or the Database name), but I am not sure. Could somebody help?


Solution

  • The problem is in the connection URL shown above: jdbc:h2:~test this does not match the connectionURL from the file standalone.xml, where the data source is defined. Once both match, the right Database (and also tables) are shown on the console.