Thursday, September 25, 2008

Seam-gen, HSQLDB and development schemas

I like using HSQLDB's in memory db for early development.  Changes the annotations on my entities and letting hbm2ddl create the schema (tables actually which is what this post is about) for me is way useful.  One of the best things about Seam IMHO.

I ran into an error in my curent project which I set up using seam-gen and giving it a schema name of "PROJECTDEV."  After creating an entity class, "Job" I ran "seam generate-ui" from my project directory.  I deployed expecting to see the default crud screens that seam generates.  However, when I clicked on the "Job List" link I got an error.  The console told me something was wrong with my schema :

Caused by: java.sql.SQLException: invalid schema name in statement

And looking further back in the logs I found error messages from Seam while the schema export was running:

[SchemaExport] invalid schema name: PROJECTDEV in statement

Poking around the web I found some references to this problem on the Hibernate forums, JBoss forums and JBoss Jira

I tried putting :


in my import.sql file, but that didn't work.  Same errors.

I had to create the schema manually in the HSQLDB database manager (I have a post on how to use this if you don't already know how.)  After that everything worked fine.
Blogged with the Flock Browser

1 comment:

Anonymous said...

Love your blog. I ran into this exact same problem and found your solution nice but wanted something even simpler. I discovered that the problem in my case was the catalog attribute in the @Table annotation for the entities. I wrote up a solution to this over at my blog