-->
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.  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Sessionfactory error: Entity class not found: ...
PostPosted: Mon Sep 25, 2006 12:28 pm 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
The tool cant generate a Sessionfactory:
Sessionfactory error: Entity class not found: ...



I know that this topic has already been discussed!

But the solutions which were pointed out there i already mentioned
1. Ive added the Output path to the "Hibernate Console Configuration" (it was automaticly there)
2. The class has been generated and is at the right position in the Output ("/bin") Directory!
3. The hsql driver (1.8.x) is in the "Hibernate Console Configuration" (this has nothing to do with the error? Or?)

The Classes are generated well but no session factory is there and my HSQL Database is emty too!

Im using a new installation (3.2.0) of Eclipse with WTP (to be more precise: wtp-all-in-one-sdk-R-1.5.0-200606281455-win32.zip).

And im using "HibernateTools-3.2.0.beta7.zip".

I (only) use these 2 files (do i need another one??) :

hibernate.cfg.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
        <property name="hibernate.connection.url">jdbc:hsqldb:hsql:/data/database</property>
        <property name="hibernate.connection.username">sa</property>
        <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
        <mapping resource="prozesshaus/Test.hbm.xml" />
    </session-factory>
</hibernate-configuration>



Test.hbm.xml

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="prozesshaus">
    <class name="Test" table="T_Test">
        <id name="id" type="integer">
            <column name="id" />
            <generator class="identity" />
        </id>
        <property name="vorname" type="string" length="30" />
        <property name="nachname" type="string" length="30" />
        <property name="geburtsdatum" type="date" />
      <property name="strasse" type="string" length="30" />
    </class>
</hibernate-mapping>


I read:
http://www.hibernate.org/hib_docs/tools ... gle/#d0e23

Thanks very much for your help!!!

Jan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 5:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what is the full stack trace?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Full Stack Trace
PostPosted: Tue Sep 26, 2006 6:57 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
Code:
entity class not found: prozesshaus.Test
org.hibernate.MappingException: entity class not found: prozesshaus.Test
entity class not found: prozesshaus.Test
java.lang.ClassNotFoundException: prozesshaus.Test
prozesshausTest


The generated class Test looks fine (in my eyes):

Code:
package prozesshaus;
// Generated 25.09.2006 17:58:47 by Hibernate Tools 3.2.0.beta7

import java.util.Date;

/**
* Test generated by hbm2java
*/
public class Test implements java.io.Serializable {

   // Fields   

   private Integer id;

   private String vorname;

   private String nachname;

   private Date geburtsdatum;

   private String strasse;

   // Constructors

   /** default constructor */
   public Test() {
   }

   /** full constructor */
   public Test(String vorname, String nachname, Date geburtsdatum,
         String strasse) {
      this.vorname = vorname;
      this.nachname = nachname;
      this.geburtsdatum = geburtsdatum;
      this.strasse = strasse;
   }

   // Property accessors
   public Integer getId() {
      return this.id;
   }

   public void setId(Integer id) {
      this.id = id;
   }

   public String getVorname() {
      return this.vorname;
   }

   public void setVorname(String vorname) {
      this.vorname = vorname;
   }

   public String getNachname() {
      return this.nachname;
   }

   public void setNachname(String nachname) {
      this.nachname = nachname;
   }

   public Date getGeburtsdatum() {
      return this.geburtsdatum;
   }

   public void setGeburtsdatum(Date geburtsdatum) {
      this.geburtsdatum = geburtsdatum;
   }

   public String getStrasse() {
      return this.strasse;
   }

   public void setStrasse(String strasse) {
      this.strasse = strasse;
   }

}


Thanks for your quick answer!! And sorry that i havent writen this in my first post (but i thought there isnt more useful information in it, is there?)

Sorry for my bad english. Im german ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 8:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and prozesshaus/Test.class is directly available below one of the paths you added to the console configuration class path ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 9:10 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
My Project name in Eclispe is "Test". My output-Folder "bin"...

The Hibernate tool added (automaticly) the build path "/Test/bin"

hm.. when i add the path "/Test/bin/prozesshaus" it does not work either!

(Other configurations in the hibernate console configuration:
Code:
- Name: Test
- Configuration File: \Test\Hibernate\hibernate.cfg.xml
- Additonal mapping files: /Test/Hibernate/Test.hbm.xml


)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 9:19 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
even if i delete all package informations ...

The generation of the Test.class works fine...

but there is still the mistake when trying to generate the session factory:

Code:
... entity class not found: Test


Test.hbm.xml:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="Test" table="T_Test">
        <id name="id" type="integer">
            <column name="id" />
            <generator class="identity" />
        </id>
        <property name="vorname" type="string" length="30" />
        <property name="nachname" type="string" length="30" />
        <property name="geburtsdatum" type="date" />
      <property name="strasse" type="string" length="30" />
    </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 9:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you didn't answer my question ;)

Is that file actually in the bin directory ? e.g. have the src/Test.java file been compiled into a bin/Test.class file ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 9:57 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
i did answer it in the first post (but didn't matter ;-))

yes.. this works fine! There is a Test.class file!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 10:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
any chance you have linked directories or UNC paths ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 10:16 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
what do you mean?

In my workspace there is a Project "Test", with following folders:

- bin (compiled code of the output, with the Test.class in it)
- data (where the Database should be in (at the Moment its emty)
- hibernate (hibernate.cfg.xml and Test.hbm.xml... which i posted already)
- src ("not compiled code" of the output, with the Test.java in it)
- web (not relevant)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 10:18 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
oh ... ive made a liked directory of the "/bin" path...

in eclipse i called it "/classes"...

moment. ill create a new project and change that!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 10:26 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
it does not have any effect... ive created a new project... with no linked output folder... with no effet :-(

All files are in my workspace Directory at:
"C:\Seminararbeit\workspace uni\"

Im using windows xp proffessional...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 10:40 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
Ive found out another strange thing:

When i use the same output and input directory a modified hibernate.cfg.xml is build. It contains the automatic generated line::

<mapping resource="Test.hbm.xml" />

But when i "rerun" the hibernate tool (first i deleted the "Additional Mapping files") then there is an error:

Quote:
Resource: Test.hbm.xml not found
<no message>


But its definitivly in the right directory (in the same dir, where the hibernate.cfg.xml is, too!!)


Top
 Profile  
 
 Post subject: Any more ideas
PostPosted: Thu Sep 28, 2006 6:19 am 
Newbie

Joined: Mon Sep 25, 2006 12:04 pm
Posts: 10
Can anyone help me... does someone have some additional ideas??? Please!!!

Thanks much!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 3:11 am 
Newbie

Joined: Tue Oct 17, 2006 3:06 am
Posts: 4
I had the same problem as mentionned above.

I succeeded in solving this problem.

When you create a new console configuration, in the classpath you have to put the path containing your classes before the jar files like drivers.

I have exactly the same directory structure.

Choose /yourProject/build/classes/

It worked for me. Hope this will help you

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 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.