Hi,
I need to create new tables to my database (hypersonic provided with JBoss 3.2.2) so I started to use SCHEMAEXPORT.
But every time I add some new mapping files to my mappings folder the SCHEMAEXPORT drops & creates ALL the tables from ALL the mapping files. (so I lose all the existing data...)
So I tried SCHEMAUPDATE, but even if the ant task printed "create table..." for the tables not present in the db to stdout, no table was created on db.
So is it possible to create only the tables not present in the database with SCHEMAEXPORT or SCHEMAUPDATE?
Filipe
----------
HIBERNATE VERSION: 2.1.3
ANT TASKS:
<target name="create-db">
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="classpath.run"/>
<schemaexport
properties="db.properties"
quiet="no"
text="no"
drop="no"
delimiter=";"
output="schema-export.sql">
<fileset dir="mappings">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
<target name="update-db">
<taskdef name="schemaupdate"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask"
classpathref="classpath.run"/>
<schemaupdate
properties="db.properties"
quiet="no">
<fileset dir="mappings">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaupdate>
</target>
LOGGING:
update-db:
[schemaupdate] 0 [main] INFO cfg.Environment - Hibernate 2.1.3
[schemaupdate] 40 [main] INFO cfg.Environment - hibernate.properties not found
[schemaupdate] 70 [main] INFO cfg.Environment - using CGLIB reflection optimizer
[schemaupdate] 111 [main] INFO cfg.Configuration - Mapping file: C:\Ni2JavaProjects\Ni2Hibernate\mappings\HibernateCompanyValueImpl.hbm.xml
[schemaupdate] 3485 [main] INFO cfg.Binder - Mapping class: com.ni2.core.HibernateCompanyValueImpl -> hibernatecompanyvalue
[schemaupdate] 3535 [main] INFO cfg.Configuration - Mapping file: C:\Ni2JavaProjects\Ni2Hibernate\mappings\MyHibernateCompanyValueImpl.hbm.
xml
[schemaupdate] 4737 [main] INFO cfg.Binder - Mapping class: com.ni2.core.MyHibernateCompanyValueImpl -> hibernatecompanyvalueb
[schemaupdate] 4817 [main] INFO dialect.Dialect - Using dialect: net.sf.hibernate.dialect.HSQLDialect
[schemaupdate] 4827 [main] INFO connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production u
se!)
[schemaupdate] 4827 [main] INFO connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
[schemaupdate] 4857 [main] INFO connection.DriverManagerConnectionProvider - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql:/
/localhost:1701
[schemaupdate] 4857 [main] INFO connection.DriverManagerConnectionProvider - connection properties: {user=sa, password=}
[schemaupdate] 4857 [main] INFO hbm2ddl.SchemaUpdate - Running hbm2ddl schema update
[schemaupdate] 4857 [main] INFO hbm2ddl.SchemaUpdate - fetching database metadata
[schemaupdate] 4907 [main] INFO hbm2ddl.SchemaUpdate - updating schema
[schemaupdate] 4907 [main] INFO cfg.Configuration - processing one-to-many association mappings
[schemaupdate] 4907 [main] INFO cfg.Configuration - processing one-to-one association property references
[schemaupdate] 4907 [main] INFO cfg.Configuration - processing foreign key constraints
[schemaupdate] create table hibernatecompanyvalueb (id varchar(50) not null, name varchar(50), locationName varchar(50), instanceDescription
varchar(50), civic varchar(50), street varchar(50), city varchar(50), stateProvince varchar(50), zipPostalCode varchar(50), country varchar
(50), contactName varchar(50), contactTitle varchar(50), contactPhone varchar(50), contactMobile varchar(50), contactFax varchar(50), contac
tEmail1 varchar(50), contactEmail2 varchar(50), primary key (id))
[schemaupdate] 4988 [main] INFO hbm2ddl.SchemaUpdate - schema update complete
[schemaupdate] 4988 [main] INFO connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:hsqldb:hsql://localhost:1701
|