-->
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.  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Hibern8IDE problems
PostPosted: Wed Jan 21, 2004 5:50 pm 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
Is anyone using this tool? I would be quite convenient for me as I am new to HQL. If I could get it to work that is...

I have my mapped classes showing up fine and everything seems OK with the configuration but whenever I try to execute my HQL (*any* HQL, however simple) I get:

java.lang.NoClassDefFoundError: javax/transaction/Synchronization
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:312)
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:325)
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:333)
at net.sf.hibern8ide.Hibern8IDE$ExecuteQuery.actionPerformed(Hibern8IDE.java:679

I've checked and this Class isn't even part of J2SE1.4.1 (which I am using).

I've got the required jars in my Classpath (Hibernate2.jar and the pf-joi-full.jar).

Am I still missing something?

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 6:04 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Add the JTA jar from the hibernate distribution.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 7:03 pm 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
Thanks. That worked fine!

So I still need the JTA jar even though I never specified anything JTA related in my hibernate.properties? Or is that a Hibern8IDE requirement...

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 7:15 pm 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
I forgot. I had an additional question:

Do you know if there is any way to automatically configure Hibern8IDE with the correct properties and hbm.xml files on startup? Like supplying program parameters. It's a drag to have to open dialogs and add the files every time you start the application...

I can't find anything about that on the tools homepage..

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 7:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I forget who it was but it has been done and I understand the patch will be reviewed. Keep an sys out for the CVS changes.


Top
 Profile  
 
 Post subject: Re:
PostPosted: Thu Jan 22, 2004 1:47 am 
Newbie

Joined: Thu Sep 18, 2003 1:50 am
Posts: 17
I use Hibern8IDE from eclipse and the following program to start configured Hibern8IDE.

package com.test;

import net.sf.hibern8ide.Hibern8IDE;
import net.sf.hibernate.cfg.Configuration;

public class StartHibern8IDE {

public static void main(String[] args) throws Exception {
Configuration configuration = new Configuration();
configuration.configure();

Hibern8IDE.startWith(configuration);
}
}

Put hibernate.cfg.xml, mappings in the class path and put <mapping resource=""/> statements in the cfg file.

Can use this until you get the func. with Hibern8IDE.

_________________
- Jeevan (G1)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 4:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
jonteponte wrote:
So I still need the JTA jar even though I never specified anything JTA related in my hibernate.properties?

Yes, see the ./lib/readme.txt in the hibernate distribution to find required jars

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 5:37 am 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
From readme:

Quote:
jta.jar
- Standard JTA API
- runtime, required for standalone operation (outside application server)


That explains why I did not miss it when running from Tomcat :)

Thanks again emmanuel

g1friend:

Thanks for the code! I'm gonna try it.

/Jonas


Top
 Profile  
 
 Post subject: Re:
PostPosted: Thu Jan 22, 2004 6:29 am 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
g1friend wrote:
Put hibernate.cfg.xml, mappings in the class path and put <mapping resource=""/> statements in the cfg file.

Can use this until you get the func. with Hibern8IDE.


Does anyone know if it's possible to set up the mappings in hibernate.properties and move that into the classpath instead of the cgf.xml file? I.e configuring the sessionfactory exclusively in .properties specifically for running ouside the container.

Since I have the JNDI Datasource defined in my .xml file I don't want to have to edit that out every time I start the Hibern8IDE since I get an stack when leaving it in and running outside the container...

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 7:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I would suggest you run Hibern8IDE from the environment you want to test in ;)

just use the code posted earlier about starting Hibern8IDE with it's startWith(configuration) method - which allows you to explore hibernate from within an application server context.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re:
PostPosted: Thu Jan 22, 2004 7:37 am 
Newbie

Joined: Thu Sep 18, 2003 1:50 am
Posts: 17
As per http://hibernate.sourceforge.net/hibern ... on-2.0.dtd, the hibernate.cfg.xml should contain atleast one <mapping> element (The content of element type "session-factory" must match "(property*,mapping+,(class-cache|collection-cache|jcs-class-cache|jcs-collection-cache)*)".). So put one mapping resource in it which you think will normally not change and load the other mapping resources like this from the code (ofcourse you need to put these all the mapping files in the classpath).

package com.test;

import java.net.URL;

import net.sf.hibern8ide.Hibern8IDE;
import net.sf.hibernate.cfg.Configuration;

public class StartHibern8IDE {

public static void main(String[] args) throws Exception {
Configuration configuration = new Configuration();
configuration.addURL(new URL("file:///c:/test3.hbm.xml"));
configuration.configure();

Hibern8IDE.startWith(configuration);
}
}



You also have the other ways to load the mappings using Configuration (addResource(), addClass(), etc)

_________________
- Jeevan (G1)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 8:04 am 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
max wrote:
I would suggest you run Hibern8IDE from the environment you want to test in ;)

just use the code posted earlier about starting Hibern8IDE with it's startWith(configuration) method - which allows you to explore hibernate from within an application server context.


Hmm. Doesn't that mean I have to start it from a servlet or something? Even if I configure it to use my ANT settings and run it from there I am still not running in the container...

Crap. I really need to look at integrating IDEA better with Tomcat... I haven't had the energy so far since I use a version (4.1.29) that is not supported by the version of IDEA I am using (3.04).

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 8:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
starting from a servlet would be a good option - the easist way IMHO

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Feature Request
PostPosted: Thu Jan 22, 2004 11:30 am 
Newbie

Joined: Thu Jan 22, 2004 11:03 am
Posts: 3
Hello!

Integrating Hibern8IDE with BeanShell = new feature is...

For example: BeanShell textarea where we can create new persistent
objects etc. and use powerful interactive scripting facilities.
http://www.beanshell.org/

_________________
Ben


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 1:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
eh - Hibern8IDE already has that feature ;)

The "Execute Java" button

_________________
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.  [ 23 posts ]  Go to page 1, 2  Next

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.