4 Replies Latest reply on Apr 12, 2006 10:57 AM by maxandersen

    generating seam files with hibernate tools prob.

    doubledenim

      I'm trying to generate my seam files from existing ejb3 entity pojos but when i go to run the console i get the following.

      org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="mypackage.persistence.myclassA"/>
       <No message>
      


      Plus i also get this in the error list. Even though I am not generating the code from a database connection..

      Problem while executing Create SessionFactory(org.hibernate.HibernateException: Hibernate Dialect must be explicitly set)
      



      org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
       at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
       at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
       at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:378)
       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
       at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:265)
       at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
       at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
       at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:260)
       at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:38)
       at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:46)
       at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
       at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
       at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
       at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
       at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
       at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
       at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
       at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
       at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
       at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
       at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
       at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
       at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
       at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
       at org.eclipse.core.launcher.Main.run(Main.java:973)
       at org.eclipse.core.launcher.Main.main(Main.java:948)
      


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE hibernate-configuration PUBLIC
       "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
       "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      <hibernate-configuration>
       <session-factory>
       <mapping class="mypackage.persistence.myclassA"/>
       ...
      
      


        • 1. Re: generating seam files with hibernate tools prob.
          doubledenim

          anyone got any ideas on this one before I jump out the window?

          I've solved the problem of "Hibernate Dialect must be explicitly set" by just adding the database connection details (even though I'm not using them).

          I'm left with this one

          org.hibernate.MappingException: An AnnotationConfiguration instance is required to use
          <No message>


          Is this a bug? Everything else seems to work fine but when I go to run i always get stopped by this error.

          • 2. Re: generating seam files with hibernate tools prob.
            maxandersen

            why do you think you don't use the connection details ?

            And if you are using ejb3/annotaiton constructs then you will need to enable ejb3/annotation for your console configuration.

            double click it and click the ejb3/annotation checkbox.

            • 3. Re: generating seam files with hibernate tools prob.
              doubledenim

              i figured that i didn't need the connection details in the session factory section if i was only going to be creating seam code from existing ejb3 entities. I could be wrong on this.

              I've got the Enable hibernate ejb3/annotations checkbox ticked. That doesn't seem to be the problem.

              In my console I've got no properties file set and no Entity resolver set. Nor do I have any mapping files set. In the classpath section i've got the path to my pojo classes and the mysql j connector.

              • 4. Re: generating seam files with hibernate tools prob.
                maxandersen

                well, its needed to show the db structure in the ui.

                ...and you still get an error for annotationconfiguration is needed ?

                ensure that the checkbox is selected and close/create the session factory - and if that does not work, restart and try again (which then indicates we have a bug ;)