Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes Updated my Eclipse with HibernateSynchrnoizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Updated my Eclipse with HibernateSynchrnoizer" Watch "Updated my Eclipse with HibernateSynchrnoizer" New topic
Author

Updated my Eclipse with HibernateSynchrnoizer

Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
Hi,
I updated my eclipse with Hibernate Synchronizer but i want to know how to use this to write successfully my first program in hibernate..
What all configuration i need to do and what all the steps to proceed further...
Please someone help me regarding the issue..
thanks in advance..
venkat Dasari


Regards,<br />Venkat Dasari<br />SCJP 1.4, SCBCD.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
this
article should help.
Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
Thanks Karthik,
I too followed the same when i was configuring but it specifies nothin about the mapping file.I tried all the steps given in that siteBut i could'nt load the tables in my mapping files...

So really i need some help reagrding the case... from the past three days i am fighting with this...

I am using thin driver in my rpoject so i loaded all the jar files which are necessary.but i could'nt get the tables in the mapping file..

Thanks in advance,
venkat Dasari
Felix Harianto
Greenhorn

Joined: Aug 27, 2004
Posts: 2
Hi Venkat,

I experienced the same probelem as yours too. In my case, after i am sure that connection setting is correct (in Eclipse) I restarted my Eclipse everything ok.

one suggestion, try to sniff the sql query that Eclipse send to ur dbms after u click 'Refresh' button. for example, I use TOAD to do this because I connect to Oracle. The query parameter should be based on field value u entered in the 'Hibernate Mapping File' Form.
Try to see whether u enter the correct value for each field (e.q Schema Pattern; Table Pattern).

Hope this would help.

Felix Harianto
Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
Hi,
thanks felix... Now i am having new errors when i run my program
Please find the errors...below..
and suggest me a solution...

Venkat Dasari

net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:872)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:896)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
at com.ats.axsis.service.workflow.demo.base._BaseRootDAO.initialize(_BaseRootDAO.java:51)
at com.ats.axsis.service.workflow.demo.base._BaseRootDAO.initialize(_BaseRootDAO.java:38)
at com.ats.axsis.service.workflow.demo.EmpTest2.main(EmpTest2.java:21)
Exception in thread "main"
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Venkat dasari:
Hi,
thanks felix... Now i am having new errors when i run my program
Please find the errors...below..
and suggest me a solution...

Venkat Dasari

net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:872)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:896)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
at com.ats.axsis.service.workflow.demo.base._BaseRootDAO.initialize(_BaseRootDAO.java:51)
at com.ats.axsis.service.workflow.demo.base._BaseRootDAO.initialize(_BaseRootDAO.java:38)
at com.ats.axsis.service.workflow.demo.EmpTest2.main(EmpTest2.java:21)
Exception in thread "main"



Do you have hibernate.cfg.xml file in your project ?


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
HI,
Yes, I do have an XML file in my project...
But even then it have the errors.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
please post hibernate.cfg.xml file....
Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
hi,
please find my hibernate.cfg.xml file below...

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory name="myHibernate" >

<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc racle:thin:@192.168.12.35:1521:Axsis</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.username">atsoltp</property>
<property name="hibernate.connection.password">atsoltp</property>
<!-- property name="hibernate.connection.pool_size"></property -->

<!-- dialect for Oracle (any version) -->
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>

<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>

</session-factory>
</hibernate-configuration>

thanks
venkat Dasari
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
what type of web/application server ? (tomcat or jboss or etc)

Your hibernate.cfg.xml file have in WEB-INF/classes/ directory or not ??
[ August 30, 2004: Message edited by: Somkiat Puisungnoen ]
Felix Harianto
Greenhorn

Joined: Aug 27, 2004
Posts: 2
Yes, I do have an XML file in my project...
But even then it have the errors.


hmm.. hv u set ur classpath to the location of hibernate.cfg.xml?

Felix Harianto.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Now, I'm use Hibernate + Tomcat.

i'm not set classpath to hibernate.cfg.xml

Please see this link ::

http://www.hibernate.org/hib_docs/reference/en/html/quickstart.html


This will help you.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Structure in my project : Tomcat + Hibernate

All file In /WEB-INF/classes/ directory
- hibernate.cfg.xml
- *.hbm.xml

in your project have structure same with me ???
Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
hi,
i am not using any application server... I am just a beginner so i am trying to do run my program without having any app server. I am successfully running the basic programs.. I am using Eclipse as my ide for writing my programs...

Now, i have a new doubt... how to execute queries.. i mean how to retrieve values from the table as a whole instead of providing a key value to the dao's load() method...

Thanks in advance for providing the solution...
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Venkat dasari:
hi,
i am not using any application server... I am just a beginner so i am trying to do run my program without having any app server. I am successfully running the basic programs.. I am using Eclipse as my ide for writing my programs...

Now, i have a new doubt... how to execute queries.. i mean how to retrieve values from the table as a whole instead of providing a key value to the dao's load() method...

Thanks in advance for providing the solution...


I'm use find() method to query data.



or

use load() method

Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Hibernate is quite powerfull when speaking about querying. Please check the methods available in Session (as Session.find Sesion.iterate). Another options you got for querying are Query and Criteria.


blog - InfoQ.com
Venkat dasari
Ranch Hand

Joined: Nov 12, 2003
Posts: 67
hi,
i am using hibernate synchronizer in my eclipse to run my program...
So it generates dao's for processing and it writes its own code for creating sessions and and it ahve method like load(for select),save(for saving) and saveorUpdate(for updating) and delete methods...
but i couldn't find any find method on it...

But i heard that we write hql in my mapping file which will helps in executing the queries.. but i am not sure about it.

If there's a solution for this please notify me...
thanks a lot
venkat Dasari
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Ali Pope:
Hibernate is quite powerfull when speaking about querying. Please check the methods available in Session (as Session.find Sesion.iterate). Another options you got for querying are Query and Criteria.


Manipulating Persistent Data
http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html
 
wood burning stoves
 
subject: Updated my Eclipse with HibernateSynchrnoizer
 
Similar Threads
annotations ?
Hibernate without J2EE server
Include Hibernate in Eclipse
Lost Hibernate tools prospective in Eclipse after update to JBoss tools
Problem when execute the JPQL with Map