1 2 Previous Next 17 Replies Latest reply on Apr 9, 2008 3:50 AM by Max Rydahl Andersen

    using HQL editor with JBoss Tools

    Arbi Sookazian Master

      using Eclipse
      Version: 3.3.1.1
      Build id: M20071023-1652
      JBoss Tools plug-in version 2.0.0.GA

      according to http://labs.jboss.com/tools/:

      Hibernate Tools Supporting mapping files, annotations and JPA with reverse engineering, code completion, project wizards, refactoring, interactive HQL/JPA-QL/Criteria execution and more.In short a merger of Hibernate Tools and Exadel ORM features.


      I'm wondering if Hibernate Tools behaves the same way as MyEclipse regarding JPAQL editor. MyEclipse does not support JPAQL editor so you basically have to add Hibernate capabilities to your Eclipse java project, reverse engineer your entities and foobar.orm.xml files, etc. before you can use the HQL editor.

      In many cases, you don't want a Hibernate-capable project; you want a JPA-capable project. So the current work-around with MyEclipse is to create another project with Hibernate capabilities for HQL editor (testing of your queries) purposes.

      How is the situation with Jboss Tools and/or JBoss dev studio (which has JBoss tools as a plugin I'm guessing)? I don't want to create the Hibernate-specific foobar.orm.xml files for a JPA project.

        • 1. Re: using HQL editor with JBoss Tools
          Max Rydahl Andersen Master

          The JPAQL editor requires a hibernate compatible jpa project.

          You don't need to add anything hibernate specific to the project if you are using pure JPA.

          Create a hibernate console configuration enabled for JPA and you can use the jpqql editor.

          ps. MyEclipse's hibernate, jpa, hql editor etc. is a fork of Hibernate Tools but with different things disabled and other enhanced. One of them sounds to be that we don't require hibernate support enabled on the project, but they do.

          • 2. Re: using HQL editor with JBoss Tools
            Arbi Sookazian Master

            Eclipse Version: 3.3.1.1
            JBoss Tools version 2.0.0.GA

            I followed your directions as well as these:

            https://www.redaht.com/docs/manuals/jboss/jboss-eap-4.2/doc/seam/Seam_Reference_Guide/CRUD_application_generator-Creating_a_Hibernate_Console_configuration.html


            The directions need to be a lot more specific (there are 5 tabs in the Hibernate Console Configuration wizard) and the screenshot in the link above is missing.

            In the main tab I entered the name of my project (in this case "ISA") that was created as a java project with SVN folders (I copied it from the original location on my C drive for testing purposes). Since this is a JPA project, I left the property file entry empty. Persistence unit name was copied from here:

            <persistence-unit name="ICOMSSecurityAudit">


            in the persistence.xml file.

            For type I selected JPA obviously.

            In the options tab, for naming strategy I entered "org.hibernate.cfg.NamingStrategy". For entity resolver I entered "org.xml.sax.EntityResolver". Both of these interfaces are in my classpath when I switch to the JavaEE perspective.

            The last three tabs I don't enter anything (classpath, mappings, common). and click OK.

            Immediately afterwards I see some exceptions in the error log:

            org.hibernate.HibernateException: /hibernate.cfg.xml not found
            
            An exception stack trace is not available.
            
            
            org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
            
            An exception stack trace is not available.
            
            org.hibernate.console.HibernateConsoleRuntimeException: Could not compute classpath
            
            An exception stack trace is not available.
            
            Unhandled event loop exception
            
            org.hibernate.console.HibernateConsoleRuntimeException: Could not compute classpath
             at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.getCustomClassPathURLS(EclipseLaunchConsoleConfigurationPreferences.java:93)
             at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:158)
             at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
             at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:66)
             at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:52)
             at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
             at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:56)
             at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
             at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
             at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:443)
             at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
             at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
             at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
             at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
             at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
             at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
             at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
             at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
             at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
             at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
             at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
             at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
             at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
             at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
             at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
            Caused by: org.eclipse.core.runtime.CoreException: Launch configuration ICOMSSecurityAudit references non-existing project ICOMSSecurityAudit.
             at org.eclipse.jdt.launching.JavaRuntime.abort(JavaRuntime.java:1321)
             at org.eclipse.jdt.launching.JavaRuntime.getJavaProject(JavaRuntime.java:1201)
             at org.eclipse.jdt.launching.StandardClasspathProvider.computeUnresolvedClasspath(StandardClasspathProvider.java:39)
             at org.eclipse.jdt.launching.JavaRuntime.computeUnresolvedRuntimeClasspath(JavaRuntime.java:1167)
             at org.hibernate.eclipse.console.utils.ClassLoaderHelper.getClasspath(ClassLoaderHelper.java:146)
             at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.getCustomClassPathURLS(EclipseLaunchConsoleConfigurationPreferences.java:84)
             ... 33 more
            


            eclipse.buildId=M20071023-1652
            java.version=1.5.0_13
            java.vendor=Sun Microsystems Inc.
            BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
            Command-line arguments: -os win32 -ws win32 -arch x86 -data C:\Documents and Settings\asookazi\workspace\testHQLeditor
            


            NOTE: I don't have any of these errors in my original Java project.

            Please advise. thx.

            • 3. Re: using HQL editor with JBoss Tools
              Max Rydahl Andersen Master

              did you select JPA in the console configuration ?


              • 4. Re: using HQL editor with JBoss Tools
                Arbi Sookazian Master

                I stated above that I selected JPA for type. Is this what you mean or what?

                • 5. Re: using HQL editor with JBoss Tools
                  Max Rydahl Andersen Master

                  ah ...i just noticed that exception says:

                  Launch configuration ICOMSSecurityAudit reference
                  s non-existing project ICOMSSecurityAudit

                  Does that project actually exist ? With that exact spelling/casing ?

                  • 6. Re: using HQL editor with JBoss Tools
                    Arbi Sookazian Master

                    I just renamed my project to ICOMSSecurityAudit and re-created the Hibernate console config and still getting same types of errors. Errors only display in Hibernate perspective, not in the JavaEE perspective.

                    Is it ok to leave the property file blank? I don't know what to put for it. Also, one of the errors is saying that "/hibernate.cfg.xml not found" but this is a JPA project and I selected that in the Hibernate Console config.

                    I wonder if I should start all over with a new workspace... or am I still missing something?

                    org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
                    
                    org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
                    at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:499)
                    at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                    at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                    at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                    at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                    at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                    at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
                    Caused by: org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
                    at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:142)
                    at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
                    ... 10 more
                    Caused by: java.lang.InstantiationException: org.xml.sax.EntityResolver
                    at java.lang.Class.newInstance0(Class.java:335)
                    at java.lang.Class.newInstance(Class.java:303)
                    at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:127)
                    ... 11 more
                    
                    java.lang.InstantiationException: org.xml.sax.EntityResolver
                    
                    java.lang.InstantiationException: org.xml.sax.EntityResolver
                    at java.lang.Class.newInstance0(Class.java:335)
                    at java.lang.Class.newInstance(Class.java:303)
                    at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:127)
                    at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
                    at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                    at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                    at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                    at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                    at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                    at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
                    
                    org.hibernate.HibernateException: /hibernate.cfg.xml not found
                    
                    org.hibernate.HibernateException: /hibernate.cfg.xml not found
                    at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
                    at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405)
                    at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
                    at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
                    at org.hibernate.console.ConsoleConfiguration.loadConfigurationXML(ConsoleConfiguration.java:299)
                    at org.hibernate.console.ConsoleConfiguration.configureStandardConfiguration(ConsoleConfiguration.java:531)
                    at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:503)
                    at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                    at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                    at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                    at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                    at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                    at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
                    
                    Unhandled event loop exception
                    
                    org.hibernate.console.HibernateConsoleRuntimeException: Could not compute classpath
                    at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.getCustomClassPathURLS(EclipseLaunchConsoleConfigurationPreferences.java:93)
                    at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:158)
                    at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                    at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:66)
                    at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:52)
                    at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
                    at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:56)
                    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
                    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
                    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:443)
                    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
                    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
                    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
                    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
                    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
                    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
                    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
                    at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
                    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
                    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
                    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
                    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
                    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
                    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
                    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
                    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
                    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
                    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
                    at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
                    Caused by: org.eclipse.core.runtime.CoreException: Launch configuration ICOMSSecurityAudit references non-existing project ICOMSSecurityAudit.
                    at org.eclipse.jdt.launching.JavaRuntime.abort(JavaRuntime.java:1321)
                    at org.eclipse.jdt.launching.JavaRuntime.getJavaProject(JavaRuntime.java:1201)
                    at org.eclipse.jdt.launching.StandardClasspathProvider.computeUnresolvedClasspath(StandardClasspathProvider.java:39)
                    at org.eclipse.jdt.launching.JavaRuntime.computeUnresolvedRuntimeClasspath(JavaRuntime.java:1167)
                    at org.hibernate.eclipse.console.utils.ClassLoaderHelper.getClasspath(ClassLoaderHelper.java:146)
                    at org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences.getCustomClassPathURLS(EclipseLaunchConsoleConfigurationPreferences.java:84)
                    ... 33 more
                    
                    
                    Launch configuration ICOMSSecurityAudit references non-existing project ICOMSSecurityAudit.




                    • 7. Re: using HQL editor with JBoss Tools
                      Arbi Sookazian Master

                      I'm going to try this again with a different project...

                      • 8. Re: using HQL editor with JBoss Tools
                        Arbi Sookazian Master

                         

                        Table 3.1. Hibernate Console Configuration Parameters

                        Persistence unit Name of the persistence unit to use No default value (lets Hibernate Entity Manager find the persistence unit)


                        http://www.hibernate.org/hib_docs/tools/reference/en/html/plugins.html#d0e189

                        so what do I put in there as an example?

                        I tried the following and it still can't find it (there are 2 persistence units in that persistence.xml file in this case, I don't know how to specify which one):

                        /SHIMS/resources/META-INF/persistence-dev.xml


                        this time after I created the java project for a different project based on existing codebase, there was already a hibernate config file in the hibernate perspective and the property file was defaulted to:

                        /SHIMS/hibernate-console.properties



                        • 9. Re: using HQL editor with JBoss Tools
                          Arbi Sookazian Master

                          also tried and got:

                          org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: '/SHIMS/resources/META-INF/persistence-dev.xml/SHIMS'.
                          
                          org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: '/SHIMS/resources/META-INF/persistence-dev.xml/SHIMS'.
                           at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:134)
                           at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
                           at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                           at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                           at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                           at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                           at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                           at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                           at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                           at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                           at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                           at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


                          based on:

                          <?xml version="1.0" encoding="UTF-8"?>
                          <!-- Persistence deployment descriptor for dev profile -->
                          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                           version="1.0">
                          
                           <persistence-unit name="SHIMS">
                           <provider>org.hibernate.ejb.HibernatePersistence</provider>
                           <jta-data-source>java:/SHIMSDatasource</jta-data-source>
                           <properties>
                           <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
                           <!--
                           <property name="hibernate.hbm2ddl.auto" value="validate"/>
                           -->
                           <property name="hibernate.show_sql" value="true"/>
                           <property name="hibernate.format_sql" value="true"/>
                           <property name="jboss.entity.manager.factory.jndi.name" value="java:/SHIMSEntityManagerFactory"/>
                           <property name="hibernate.default_catalog" value="boSHIMS"/>
                           <property name="hibernate.default_schema" value="dbo"/>
                           </properties>
                           </persistence-unit>
                          
                           <persistence-unit name="coxIM">
                           <provider>org.hibernate.ejb.HibernatePersistence</provider>
                           <jta-data-source>java:/COXIMDatasource</jta-data-source>
                           <properties>
                           <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
                           <!--
                           <property name="hibernate.hbm2ddl.auto" value="validate"/>
                           -->
                           <property name="hibernate.show_sql" value="true"/>
                           <property name="hibernate.format_sql" value="true"/>
                           <property name="jboss.entity.manager.factory.jndi.name" value="java:/COXIMEntityManagerFactory"/>
                           <property name="hibernate.default_catalog" value="coxIM"/>
                           <property name="hibernate.default_schema" value="dbo"/>
                           </properties>
                           </persistence-unit>
                          
                          </persistence>


                          • 10. Re: using HQL editor with JBoss Tools
                            Arbi Sookazian Master

                            these are all Seam 2.0.0.GA projects, not sure if I stated that before or not.

                            I found the following thread that seemed useful, but when I copied my persistence.xml file into src/META-INF in the project root and rebuilt config with 'SHIMS' as the persistence unit entry, same exception occurs (could not load JPA configuration, persistence unit not found: 'SHIMS').
                            http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103463#4103463

                            • 11. Re: using HQL editor with JBoss Tools
                              Max Rydahl Andersen Master

                              Just because there is a field it does not need to be filled out.

                              The only ones that normally needs "filling" is project name (with a *valid* project name) and possibly hibernate-console.properties to point to a file that overrides any j2ee specific connection setup.

                              And if you have multiple punits, the name of the one you want should be typed in to persistence unit field.

                              Is this on a seam project or your own setup ? if own setup remember that currently we assume your classpath looks like an JPA archive (e.g. persistence.xml is in META-INF/persistence.xml on the classpath)

                              • 12. Re: using HQL editor with JBoss Tools
                                Max Rydahl Andersen Master

                                Ah didn't see your last comment until now.

                                Please try and restart eclipse, clean and rebuild the project and then open the configuration...and then show me the full exeception trace of that error (from Error Log View)

                                • 13. Re: using HQL editor with JBoss Tools
                                  Arbi Sookazian Master

                                  well I did the above instructions and still didn't work.

                                  the persistence.xml in the exploded deployment in the %JBOSS_HOME%/server/default/deploy folder was only found in

                                  C:\jboss-4.2.1.GA\server\default\deploy\SHIMS.ear\SHIMS.jar\META-INF

                                  so I closed Eclipse and copied that persistence.xml into:

                                  C:\jboss-4.2.1.GA\server\default\deploy\SHIMS.ear\META-INF as well just to be safe.

                                  restarted Eclipse and rebuild the hibernate config. when I refresh the hibernate config I still get the same errors:

                                  org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: 'SHIMS'.
                                  
                                  org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: 'SHIMS'.
                                   at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:134)
                                   at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
                                   at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                                   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                                   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                                   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                                   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                                   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                                   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                                   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                                   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                                   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
                                  
                                  org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
                                  
                                  org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
                                   at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:142)
                                   at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
                                   at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                                   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                                   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                                   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                                   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                                   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                                   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                                   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                                   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                                   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
                                  Caused by: org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: 'SHIMS'.
                                   at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:134)
                                   ... 11 more
                                  
                                  org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
                                  
                                  org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
                                   at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:499)
                                   at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
                                   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
                                   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
                                   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
                                   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
                                   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
                                   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
                                   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
                                   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
                                   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
                                  Caused by: org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
                                   at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:142)
                                   at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
                                   ... 10 more
                                  Caused by: org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: 'SHIMS'.
                                   at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:134)
                                   ... 11 more


                                  Once again, here is the contents of the persistence.xml:

                                  <?xml version="1.0" encoding="UTF-8"?>
                                  <!-- Persistence deployment descriptor for dev profile -->
                                  <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                                   version="1.0">
                                  
                                   <persistence-unit name="SHIMS">
                                   <provider>org.hibernate.ejb.HibernatePersistence</provider>
                                   <jta-data-source>java:/SHIMSDatasource</jta-data-source>
                                   <properties>
                                   <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
                                   <!--
                                   <property name="hibernate.hbm2ddl.auto" value="validate"/>
                                   -->
                                   <property name="hibernate.show_sql" value="true"/>
                                   <property name="hibernate.format_sql" value="true"/>
                                   <property name="jboss.entity.manager.factory.jndi.name" value="java:/SHIMSEntityManagerFactory"/>
                                   <property name="hibernate.default_catalog" value="boSHIMS"/>
                                   <property name="hibernate.default_schema" value="dbo"/>
                                   </properties>
                                   </persistence-unit>
                                  
                                   <persistence-unit name="coxIM">
                                   <provider>org.hibernate.ejb.HibernatePersistence</provider>
                                   <jta-data-source>java:/COXIMDatasource</jta-data-source>
                                   <properties>
                                   <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
                                   <!--
                                   <property name="hibernate.hbm2ddl.auto" value="validate"/>
                                   -->
                                   <property name="hibernate.show_sql" value="true"/>
                                   <property name="hibernate.format_sql" value="true"/>
                                   <property name="jboss.entity.manager.factory.jndi.name" value="java:/COXIMEntityManagerFactory"/>
                                   <property name="hibernate.default_catalog" value="coxIM"/>
                                   <property name="hibernate.default_schema" value="dbo"/>
                                   </properties>
                                   </persistence-unit>
                                  
                                  </persistence>


                                  • 14. Re: using HQL editor with JBoss Tools
                                    Max Rydahl Andersen Master

                                    Why are you looking in server deploy directory when we are just talking about running the HQL editor on your eclipse projects ?

                                    its the classpath of your eclipse project that is relevant here.

                                    1 2 Previous Next