-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: problems trying to export the schema to hsqldb
PostPosted: Mon Oct 04, 2004 1:00 pm 
Newbie

Joined: Mon Oct 04, 2004 12:10 pm
Posts: 2
I made minor changes to the build.xml file, specifically the exportddl target so that it would update the standalone hsqldb database. I made the following changes.

[code]<target name="exportddl" depends="compiletest" description="Export the DDL to caveatemptor.ddl">
<schemaexport
config="${classes.dir}/hibernate.cfg.xml"
quiet="no"
text="no"
drop="no">
<!-- Previous attributes were set to yes, drop was not present -->
<!-- output="${basedir}/caveatemptor.ddl"
delimiter=";"/>-->
<fileset dir="${classes.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>[code]

It never actually makes it to the db update however, this is the output and exception:

[code]Buildfile: build.xml

clean:
[delete] Deleting directory C:\my\Programming\Projects\caveatemptor\build

compiletest:
[mkdir] Created dir: C:\my\Programming\Projects\caveatemptor\build\standalone
[javac] Compiling 52 source files to C:\my\Programming\Projects\caveatemptor\build\standalone
[copy] Copying 12 files to C:\my\Programming\Projects\caveatemptor\build\standalone

exportddl:
[schemaexport] 11:52:36,588 INFO Environment: Hibernate 2.1.6
[schemaexport] 11:52:36,588 INFO Environment: hibernate.properties not found
[schemaexport] 11:52:36,598 INFO Environment: using CGLIB reflection optimizer
[schemaexport] 11:52:36,618 INFO Configuration: configuring from file: hibernate.cfg.xml
[schemaexport] 11:52:36,958 INFO Configuration: Mapping resource: org/hibernate/auction/model/User.hbm.xml
[schemaexport] 11:52:37,249 INFO Binder: Mapping class: org.hibernate.auction.model.User -> USERS
[schemaexport] 11:52:38,140 INFO Configuration: Mapping resource: org/hibernate/auction/model/Item.hbm.xml
[schemaexport] 11:52:38,230 INFO Binder: Mapping class: org.hibernate.auction.model.Item -> ITEM
[schemaexport] 11:52:38,290 INFO Configuration: Mapping resource: org/hibernate/auction/model/Category.hbm.xml
[schemaexport] 11:52:38,350 INFO Binder: Mapping class: org.hibernate.auction.model.Category -> CATEGORY
[schemaexport] 11:52:38,360 INFO Configuration: Mapping resource: org/hibernate/auction/model/CategorizedItem.hbm.xml
[schemaexport] 11:52:38,410 INFO Binder: Mapping class: org.hibernate.auction.model.CategorizedItem -> CATEGORIZED_ITEM
[schemaexport] 11:52:38,440 INFO Configuration: Mapping resource: org/hibernate/auction/model/Bid.hbm.xml
[schemaexport] 11:52:38,491 INFO Binder: Mapping class: org.hibernate.auction.model.Bid -> BID
[schemaexport] 11:52:38,501 INFO Configuration: Mapping resource: org/hibernate/auction/model/BillingDetails.hbm.xml
[schemaexport] 11:52:38,551 INFO Binder: Mapping class: org.hibernate.auction.model.BillingDetails -> BILLING_DETAILS
[schemaexport] 11:52:38,671 INFO Binder: Mapping joined-subclass: org.hibernate.auction.model.CreditCard -> CREDIT_CARD
[schemaexport] 11:52:38,691 INFO Binder: Mapping joined-subclass: org.hibernate.auction.model.BankAccount -> BANK_ACCOUNT
[schemaexport] 11:52:38,691 INFO Configuration: Mapping resource: org/hibernate/auction/model/Comment.hbm.xml
[schemaexport] 11:52:38,731 INFO Binder: Mapping class: org.hibernate.auction.model.Comment -> COMMENTS
[schemaexport] 11:52:38,741 INFO Configuration: Mapping resource: org/hibernate/auction/persistence/audit/AuditLogRecord.hbm.xml
[schemaexport] 11:52:38,791 INFO Binder: Mapping class: org.hibernate.auction.persistence.audit.AuditLogRecord -> AUDIT_LOG
[schemaexport] 11:52:38,791 INFO Configuration: Configured SessionFactory: null
[schemaexport] 11:52:38,811 INFO Configuration: Mapping file: C:\my\Programming\Projects\caveatemptor\build\standalone\org\hibernate\auction\model\Bid.hbm.xml
[schemaexport] 11:52:38,871 ERROR Configuration: Could not compile the mapping document
[schemaexport] net.sf.hibernate.MappingException: duplicate import: Bid
[schemaexport] at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
[schemaexport] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[schemaexport] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[schemaexport] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[schemaexport] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
[schemaexport] 11:52:38,881 ERROR Configuration: Could not configure datastore from file: C:\my\Programming\Projects\caveatemptor\build\standalone\org\hibernate\auction\model\Bid.hbm.xml
[schemaexport] net.sf.hibernate.MappingException: duplicate import: Bid
[schemaexport] at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
[schemaexport] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
[schemaexport] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[schemaexport] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[schemaexport] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[schemaexport] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[schemaexport] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)


BUILD FAILED
C:\my\Programming\Projects\caveatemptor\build.xml:111: Schema text failed: net.s
f.hibernate.MappingException: duplicate import: Bid[/code]

I can't tell if I've just screwed up settings for the database or if it's something else. Any ideas? I've seen where duplicate imports have occurred because of missing id's, but that's not the case with Bid.

I'm just getting into the book, but it's a godsend already.
Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 4:37 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Uhm, and if you run the build and test or export (to a file) without your changes, it works? I dont' really see what you have changed and I don't understand why (the tests automatically create/drop the database).

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 8:52 am 
Newbie

Joined: Mon Oct 04, 2004 12:10 pm
Posts: 2
I use a task similar to the 'exportddl' task that uses the SchemaUpdateTask to make changes in the hsqldb standalone database.
When I use the default 'exportddl' task, which just sends output to file, yes it works. But when I change the settings for the SchemaUpdateTask,
    Changing 'quiet' to 'no'
    Changing 'text' to 'no'
    Adding attribute 'drop' set to 'no'
    Removing the 'output' attribute
    Removing the 'delimiter' attribute
    Adding the element 'fileset' and including the mapping files

It should then update the hsqldb, allowing me to open the HSQL Database Mananger and see/play with the tables.
When I do this, the SchemaUpdateTask complains about the Bid mapping file. The exception is a MappingException, the message states a duplicate import.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.