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
|