Eclipse Hibernate plugin

zolf
zolf used Ask the Experts™
on

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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Awarded 2011
Awarded 2011

Commented:

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
Awarded 2011
Awarded 2011

Commented:

Author

Commented:

my apologies,can you please guide me,i dont seem to understand what to do
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Author

Commented:

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>

Author

Commented:
in hibernate perspective in Eclipse,i have these jars too
16-05-2011-10-22-29.gif
Mick BarryJava Developer
Top Expert 2010

Commented:
have you specified type jpa in your console configuration?

Author

Commented:

objects:

please see the image
16-05-2011-10-42-33.gif
Mick BarryJava Developer
Top Expert 2010

Commented:
it should be set to jpa
Mick BarryJava Developer
Top Expert 2010

Commented:
and set your connection to the jpa configured one (i assume you configuring the connection with jpa)

Author

Commented:

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
Mick BarryJava Developer
Top Expert 2010

Commented:
see my comment above regards configuring connection

Author

Commented:

>>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
Mick BarryJava Developer
Top Expert 2010

Commented:
no, the database connection in the console configuration
Mick BarryJava Developer
Top Expert 2010

Commented:
yes

looks like you also need to use a JPA Project

Author

Commented:

so,i need to delete this project and again start new with JPA project??
Java Developer
Top Expert 2010
Commented:
yes (but don't delete it right away, instead create new project and copy resources into it)

Author

Commented:
cheers

Author

Commented:

i am sorry,i get this error
16-05-2011-11-18-26.gif
Mick BarryJava Developer
Top Expert 2010

Commented:
is it included in your persistence.xml?

Author

Commented:

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;
      }

Author

Commented:

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

Author

Commented:

got it.thanks!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial