-->
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.  [ 12 posts ] 
Author Message
 Post subject: Hibernate console standalone?
PostPosted: Tue Mar 27, 2007 2:39 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
Hello,

Is it possible to run the Hibernate console standalone, i.e. outside of the Eclipse IDE?

Thanks,
Ray


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 4:40 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
No. It's an Eclipse plugin.

You can, however, run the reverse engineering & code generators through Ant, of course.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 5:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we actually have code contributed so it can run as a standalone RCP application, but it doesn't give you alot since it uses the JDT for the criteria editor and other things.

What is the problem with it being an eclipse plugin ? fyi - You don't have to have any projects defined to use it; just a classpath and hence your eclipse install can just be empty.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 11:11 am 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
we actually have code contributed so it can run as a standalone RCP application, but it doesn't give you alot since it uses the JDT for the criteria editor and other things.

What is the problem with it being an eclipse plugin ? fyi - You don't have to have any projects defined to use it; just a classpath and hence your eclipse install can just be empty.


Actually, I have been trying to get this to work all morning. When I tried to define a console configuration without having any project the pop-up for the hibernate configuration file wouldn't let me pick anything.

So I defined a project and set it up to the point where it would compile without errors. (Note that none of my files are under the eclipse "workspace" directory.) Then I tried to set up a hibernate console configuration again. Now I get a class not found exception on my entity class when I access the session factory. I tried adding everything I could think of to the classpath for the hibernate console, but to no avail.

So I have spent the entire morning on this and I have gotten nowhere. (And that is what is wrong with it being an eclipse plug-in.) In all seriousness however, I'd appreciate any help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 11:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I don't have any of my files under eclipse workspace neither (not in any way an eclipse requirement).

Ah ... the cfg.xml selector assumes a project...stupid me ;) ..anyhow simple to solve for you (please put it in jira)

If you get a classnotfoundexception then that is 99% sure because you haven't added enough to the classpath.

What do you put there ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 12:02 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
I don't have any of my files under eclipse workspace neither (not in any way an eclipse requirement).

Ah ... the cfg.xml selector assumes a project...stupid me ;) ..anyhow simple to solve for you (please put it in jira)

If you get a classnotfoundexception then that is 99% sure because you haven't added enough to the classpath.

What do you put there ?


I've added the JDBC driver (the database connection appears to work), jar files containing the POJOs (I also tried the eclipse build directory as well as my regular IDE's build directory), then I have added every library jar used by the application even though I do not think they should be a factor. I haven't added any hibernate jars, including the ehcache jar.

Looking at the POJO in question it only has dependencies on classes in the same package (likewise for these classes) plus Java classes like java.lang.String and java.io.Serializable.

I understand your initial conclusion that it is a classpath issue but I'm running out of ways to approach the problem from that end.

If you can direct me to the JIRA site I will happily file a bug for the configuration selector.

Thanks,
Ray


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 12:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
google hibernate jira ;)

What is the CNFE exactly ?

Maybe you are using JDK 5 classes while running eclipse with JDK 1.4 ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 1:34 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
max wrote:
google hibernate jira ;)

What is the CNFE exactly ?

Maybe you are using JDK 5 classes while running eclipse with JDK 1.4 ?


It could be that I am running JDK 5 with eclipse as JDK 1.4. My classes were definitely compiled with JDK 5. Unfortunately the default JDK on my system is 1.4.2. I did think of this and I made the following configuration change in eclipse.ini:
Code:
-vm C:\jdk1.5.0_11\bin\java.exe
-vmargs
-Xms40m
-Xmx256m

Perhaps this is incorrect or something else is necessary?

Here is the stack trace:

Code:
org.hibernate.MappingException: entity class not found: com.servecentral.model.Account
   at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:99)
   at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
   at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
   at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:118)
   at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:425)
   at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
   at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:282)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:85)
   at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:277)
   at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:41)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:88)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.lang.ClassNotFoundException: com.servecentral.model.Account
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)
   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:141)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:96)
   ... 17 more



Thanks again,
Ray


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 1:59 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
Aha, max you were correct, it was a 5.0 vs. 1.4 conflict. I set up my PATH to point to 5.0 and invoked eclipse from the command line to get around it. Now the Session Factory tab works.

However, when I try to run a simple query (select a from Account a), I get the following errors:

- "Unhandled event loop exception" with no stack trace available
- the following null pointer exception:

Code:
java.lang.NullPointerException
   at java.util.TreeMap.compare(TreeMap.java:1093)
   at java.util.TreeMap.getEntry(TreeMap.java:347)
   at java.util.TreeMap.get(TreeMap.java:265)
   at org.hibernate.console.KnownConfigurations.find(KnownConfigurations.java:225)
   at org.hibernate.eclipse.console.AbstractQueryEditor.getConsoleConfiguration(AbstractQueryEditor.java:51)
   at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:61)
   at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:52)
   at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
   at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:56)
   at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
   at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
   at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
   at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
   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.core.launcher.Main.invokeFramework(Main.java:336)
   at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
   at org.eclipse.core.launcher.Main.run(Main.java:977)
   at org.eclipse.core.launcher.Main.main(Main.java:952)



Thanks,
Ray


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 2:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm...could you try and run with a nightly build and see if that helps resolve your problem ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 2:18 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 2:46 pm
Posts: 32
I seem to have resolved all my issues (at least for the moment). The NPE was caused by not selecting anything in the unlabeled pulldown to the right of the green arrow button in the HQL editor. So we'll call that one a combination of user error and poor error feedback. It looks like this might be issue HBX-819.

I had an error in my eclipse.ini, apparently one should place one argument per line. The corrected file looks like the following:

Code:
-vm
C:\jdk1.5.0_11\bin\javaw.exe
-vmargs
-Xms40m
-Xmx256m


Finally I did file a bug for the configuration issue when one does not have a project (HBX-921).

Thanks for your help troubleshooting!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 2:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
thanks for reporting the issues.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.