Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

Eclipse Hibernate plugin


Hello there,

I am using eclipse IDE with hibernate plugin to write Hibernate JPA application. The problem I have is when I right click the project to provide me with the mapping diagram.i get error.But I have another project which uses hibernate with the mapping in the cfg.xml and for it it displays the mapping diagram. I am wondering if it works with JPA.please help.

cheers
Zolf
16-05-2011-09-42-29.gif
Avatar of for_yan
for_yan
Flag of United States of America image


This seems to be a discussion of related problem

(Persistence unit not found):

Perhoas you could find somethig useful here:
https://forum.hibernate.org/viewtopic.php?f=6&t=1002123
Avatar of Zolf

ASKER


my apologies,can you please guide me,i dont seem to understand what to do
Avatar of Zolf

ASKER


do i add this in my configuration file as mentioned here http://docs.jboss.org/tools/3.0.0.GA/en/hibernatetools/html/ant.html

<hibernatetool>

 <jdbcconfiguration propertyfile="etc/hibernate.properties" />

 <hbm2hbmxml destdir="${build.dir}/src" />

</hibernatetool>
Avatar of Zolf

ASKER

in hibernate perspective in Eclipse,i have these jars too
16-05-2011-10-22-29.gif
Avatar of Mick Barry
have you specified type jpa in your console configuration?
Avatar of Zolf

ASKER


objects:

please see the image
16-05-2011-10-42-33.gif
it should be set to jpa
and set your connection to the jpa configured one (i assume you configuring the connection with jpa)
Avatar of Zolf

ASKER


if i change to JPA,it then gives me this warning

[Classpath]: Persistence unit not found: 'null'.

what do i need to do.please guide me
see my comment above regards configuring connection
Avatar of Zolf

ASKER


>>and set your connection to the jpa configured one
you mean this. i have the jars in my classpath,i have the image attached above
no, the database connection in the console configuration
yes

looks like you also need to use a JPA Project
Avatar of Zolf

ASKER


so,i need to delete this project and again start new with JPA project??
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

cheers
Avatar of Zolf

ASKER


i am sorry,i get this error
16-05-2011-11-18-26.gif
is it included in your persistence.xml?
Avatar of Zolf

ASKER


i was running my JPA application without this persistence.xml. the book i am refering to does not mention anything about this xml file. i mention my class files like this

public static Configuration getInitializedConfiguration()
      {
            Configuration config = new Configuration();
            /* add all of your JPA annotated classes here!!! */
            config.addAnnotatedClass(Client.class);
            config.addAnnotatedClass(ClientDetail.class);
            config.addAnnotatedClass(Address.class);
            config.addAnnotatedClass(Skill.class);
            config.configure();
            return config;
      }
Avatar of Zolf

ASKER


i also have my hibernate.cfg.xml file in my root path
Avatar of Zolf

ASKER


got it.thanks!!