[hibernate-issues] [Hibernate-JIRA] Created: (HBX-732) SchemaExport fails when using annotated classes

Jared Warren (JIRA) noreply at atlassian.com
Sat Aug 19 00:29:18 EDT 2006


SchemaExport fails when using annotated classes
-----------------------------------------------

         Key: HBX-732
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-732
     Project: Hibernate Tools
        Type: Bug

  Components: reverse-engineer  
    Versions: 3.1beta3    
 Environment: Hibernate 3.1.3, Hibernate Annotations 3.2.0, hsqldb
    Reporter: Jared Warren


When you try to run SchemaExport from the command line with a single file defined in a <mapping class"..."> element, it fails with the following exception:

org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="com.drinkupstream.heroes.Hero"/>
	at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1478)
	at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
	at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
	at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
	at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
	at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:359)

Changing line 313 (the first real line in the main) from:
   Configuration cfg = new Configuration();
to:
    Configuration cfg = new AnnotationConfiguration();

fixes the problem.    But I don't know if that introduces other bugs......it's just a hack on my end.  Another possibility would be to wait until after the args are parsed to instantiate a Configuration and provide an arg that will dictate with Configuration to instantiate.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list