In Grails I can create domain objects to a H2 in memory dataSource in BootStrap and get results back ok, but once the app is up (eg query from GSP or contro
most inmemory database tie the database to the connection used. Hibernate opens a connection for each session so only the session with the SchemaExport has the database with the correct schema and is disposed immediatly. to solve this you have to use the same connection for all sessions which access the inmemory database.
connection = session.getConnection();
sessionfactory.openSession(connection);