-->
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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate Console perspective - getting Sessionfactory error
PostPosted: Fri Feb 17, 2006 1:21 pm 
Newbie

Joined: Sun Sep 18, 2005 6:34 pm
Posts: 12
Hibernate version:Tools 3.1 beta 4

First time tring to use the Hibernate Console perspective and I cant get the console to create a sessionfactory.

The Error says Hibernate tools Sessionfactory error: entity class not found com.portal.model.TBLProperties

I think I have included this directory for my POJO and the one Mapping file correctly becuase I can visual see the class in the Hibernate Configuration Perspective ...under Configuations and I can also see the Database attribues as well.


What do you think could be the problem?

Thanks inadvance for your thoughts!



Mapping documents:
-------------Console configuration ----------------------
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.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">pmdev123</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3309/test</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
   

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



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="com.portal.model">

        <class name="TBLProperties"
            table="TBL_APP_PROPERTIES"
            discriminator-value="C">
               
                <id
                 name="propSeqNum"
                 type="java.lang.Integer"
                 column="PROP_SEQ_NUM"
             >
                 <generator class="assigned" />
               </id>
              <property
                    name="propKeyTxt"
                    type="java.lang.String"
                    column="PROP_KEY_TXT"
                    length="80"
            />
                <property
                 name="propKeyValTxt"
                 type="java.lang.String"
                 column="PROP_KEY_VAL_TXT"
                 length="2500"
             />
             <property
                 name="propEnvrnCd"
                 type="java.lang.String"
                 column="PROP_ENVRN_CD"
                 length="3"
             />
             <property
                 name="propKeyCmntTxt"
                 type="java.lang.String"
                 column="PROP_KEY_CMNT_TXT"
                 length="255"
             />
             <property
                 name="propSectTxt"
                 type="java.lang.String"
                 column="PROP_SECT_TXT"
                 length="50"
             />
        </class>
       
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 2:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ever thought about adding the model classes to the classpath of the console configuration as specificed by the docs (and btw. autodetected if you start a wizard when a java project is selected) ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Hibernate Console perspective - getting Sessionfactory error
PostPosted: Fri Feb 17, 2006 2:33 pm 
Newbie

Joined: Sun Sep 18, 2005 6:34 pm
Posts: 12
Max,

I did do this, both manually entering the directory location and and using the wizard. Note... when using the wisard it did auto populate the directory in which my POJO exists. However, I still get the error when the sessionfactory is being created.

John


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 4:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ever thought about adding the model classes to the classpath of the console configuration as specificed by the docs (and btw. autodetected if you start a wizard when a java project is selected) ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 4:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and the project is actually built so the classes are inside that directory ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: RE: Making sure my POJO gets built.
PostPosted: Fri Feb 17, 2006 6:07 pm 
Newbie

Joined: Sun Sep 18, 2005 6:34 pm
Posts: 12
Hi Max,

The Class file for this java code gets built and resides in the same folder as the POJO code which is com/portal/model and I have confirmed that the class file is there.

Inventory of files in the follwoing folder...

HibernateSandbox/com/portal/model/TBLProperties.java
HibernateSandbox/com/portal/model/TBLProperties.class
HibernateSandbox/com/portal/model/TblAppProperties.hbm.xml

Hibernate Console Configuration Classpath includes ....
"HibernateSandbox/com/portal/model/"


Should this work?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 6:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no - a classpath does not work that way.

the entry in the classpath should be HibernateSandbox/ since the class name is com.port.model.something

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Almost working ....
PostPosted: Fri Feb 17, 2006 7:13 pm 
Newbie

Joined: Sun Sep 18, 2005 6:34 pm
Posts: 12
Hi Max,

I did select that value early on but when I got the following error "Lazy Tree Error (Error while fetching childern) - Java.lang.NullpointerException".... and still do get that error

What I have currenly done is to configure Eclipse to build my project in a sepeate build directory..... and I now see that my sessionfactory has started!!!!

Thankyou for your help.
John


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 4:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
...so did you solve your problem ?

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