-->
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.  [ 2 posts ] 
Author Message
 Post subject: Setting up hibernate tools to work with Annotations or JPA
PostPosted: Fri Jul 03, 2009 12:20 pm 
Newbie

Joined: Fri Jul 03, 2009 12:08 pm
Posts: 1
Hey folks,

Our model is mapped using Annotations and we have a persistence.xml file available. I tried to setup the easiest possible configuration as I'm just trying to prototype HQL queries against our database instead of having to deploy them and debug into the SessionFactoryImpl in order to get the syntax of the query correct.

Alas I can't seem to be able to get it to work right. I was getting a cannot locate treecache.xml exception when I attempted the JPA option. So instead I tried to create a basic AnnotationConfiguration.

The configuration has our model project specified which contains all annotated objects.
I created a hibernate.cfg.xml file via the wizard that simplified the connection and looks like the following with deets commented out.

<hibernate-configuration>
<session-factory name="SessionFactory">
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">********</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@10.10.8.20:1521:SIDB</property>
<property name="hibernate.connection.username">myusername</property>
<property name="hibernate.default_schema">myschema</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
</session-factory>
</hibernate-configuration>

When I expand the 'hibernate' node it provides three other nodes,
Configuration
SessionFactory
Database

Expanding either the Configuration or SessionFactory tabs do nothing. I would have thought that the SessionFactory node would have then supplied all the classes for which it found annotations?

I can't see what's going on under the hood as I don't know where the output for the Hibernate tools login is and the only info that seems to be printed out in the Plugin perspective relates to errors.

I'm using Ganymede and hibernate 3.2.6.ga.jar

Would anyone have any idea as to why the tool doesn't seem to be picking up the classes? Or even where I can find the tools output log. I found the hibernate-tools.log file in the .plugins folder of the .metadata folder under my home directory but it's empty.

This would be fantastic if we could get this to work as it would save so much time as redeployment and test is no way to prototype a query. Any help greatly appreciated.

Thanks,
Mark.


Top
 Profile  
 
 Post subject: Re: Setting up hibernate tools to work with Annotations or JPA
PostPosted: Sun Aug 02, 2009 10:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
If your persistence.xml needs a treecache.xml then you need to have that one the classpath. Workaround: don't enable caching when you use it from the tools (doesn't really make sense for query prototyping).

And the difference or rather one of the differences between JPA and Hibernate Annotations is that JPA scans automatically for classes/mappings, Hibernate annotations does not - which explains why you don't see anything.

_________________
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.  [ 2 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.