0 Replies Latest reply on Aug 28, 2006 12:34 PM by knaveofhearts

    Need help porting HSQL database created with EJB 3

    knaveofhearts Newbie

      I have created a number of EJB 3.0 entities with JBoss 4.0.4 using HSQLDB, along with some stateless session beans and clients exercising those entities. Everything works fine using HSQLDB.

      My plan has been to do most of the class development with HSQLDB with a persistence.xml file that has hibernate.hbm2ddl.auto set to create-drop, then save the database to a more permanent form by swapping out the HSQL persistence.xml and JCA files for ones using another database, such as Firebird or PostgreSQL. The idea is to not have to create the schema directly using SQL.

      Firebird has a FBManager, accessed through the firebird-ds file, that allows you to create-drop, as with HSQLDB. In principle, I ought to be able to have the schema created for me automatically using the 2 swaps mentioned above. However, I have run into the following problem, which appears in the JBoss app server log when I try to deploy the jar file for the application:

      Precision must be from 1 to 18 ... [SchemaExport] Unsuccessful: create table AbstractAcct (id integer not null, balance numeric(19,2), primary key (id))
      The "balance" variable is declared to be a BigDecimal in the Java code. The JBoss CMP file (standardjbosscmp-jdbc.xml) has no explicit mapping for java.math.BigDecimal for Firebird (although BigDecimal is mapped to various things for some other data sources). Suggestions about how to fix this problem?

      The problem with PostgreSQL is that there does not appear to be any way to dynamically create the database from the annotated entity classes. Am I wrong about this?