-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate console: Entities only in default package?
PostPosted: Sat Jan 21, 2006 8:48 am 
Newbie

Joined: Sat Jan 14, 2006 7:36 pm
Posts: 4
I working on ebj3demo articles, all work fine. :-)

When I try to use the Hibernate console, I got two problems!

1) I must use the hibernate-mapping! If I not use the xmls file I not able to view the entities!

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">
<!-- Generated 20-gen-2006 23.01.01 by Hibernate Tools 3.1.0 beta3 -->
<hibernate-mapping>
    <class name="Author" table="author" catalog="jboss">
   
        <id name="authorId" type="integer">
            <column name="authorId" />
            <generator class="assigned" />
        </id>
        <property name="name" type="string">
            <column name="name" />
        </property>
        <set name="articles" inverse="true">
            <key>
                <column name="authorId" />
            </key>
            <one-to-many class="Article" />
        </set>
    </class>
</hibernate-mapping>


2) If I put the code in the package org.jboss.ejb3demo an error occour:
Problems while creating sessionfactory
java.lang.NoClassDefFoundError: Author (wrong name: org/jboss/ejb3demo/Author)


but if I put classes in default package all work!
how I correct this?
I want to put the classes in the right package and not in default package!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 4:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
#1 Why do you need to use xml files ? You need to click "enable ejb3/annotations" in the console configuration and then point to an hibernate.cfg.xml which has your classes listed.

#2 you have mapped class Author in that mapping file, not org.jboss.ejb3demo.Author

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