-->
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.  [ 5 posts ] 
Author Message
 Post subject: bad formated mapping file
PostPosted: Wed Mar 21, 2007 10:33 am 
Beginner
Beginner

Joined: Wed Mar 21, 2007 10:23 am
Posts: 20
I'm new in the hibernate world and after having tried to use this framework, I still encounter some trouble using my mapping file, the file is like that :
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.genebio.toxico.compound">
    <class name="CompoundImpl" table="COMPOUND">
        <id name="id" column="COMPOUND_ID">
            <generator class="native"/>
        </id>
        <property name="cid" type="string" column="COMPOUND_CID"/>
        <property name="SMILE" type="string" column="COMPOUND_SMILE"/>
    </class>
</hibernate-mapping>

But when I launch my hibernate consol in eclipse, the consol report an error like [quote][/quote]org.hibernate.InvalidMappingException: Could not parse mapping document from file /home/yannmauron/Desktop/test/ToxicoMSJava2/src/java/com/genebio/toxico/compound/NewMapping.hbm.xml
org.hibernate.MappingException: invalid mapping
org.hibernate.MappingException: invalid mapping
org.xml.sax.SAXParseException: Element "class" requires additional elements.

Do you have an idea ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 3:31 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Well, at first sight, your mapping seems correct to me. Could you give more logs? Use log4j for example and configure it to see org.hibernate in debug mode.

What's the full stacktrace of your error?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 4:29 am 
Beginner
Beginner

Joined: Wed Mar 21, 2007 10:23 am
Posts: 20
Right, in fact, yesterday, I have tried almost evry possibility and when I have restart my eclipse, the system worked...
But my next problem is the following :

Bonjour,

I have a config file like that :

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">org.hsqldb.jdbcDriver</property>
        <property name="hibernate.connection.url">jdbc:hsqldb:/home/yannmauron/toxico_db</property>
        <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
   
   
        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>


        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>
       
    </session-factory>
</hibernate-configuration>



a mapping file as :

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.genebio.toxico.compound">
    <class name="CompoundImpl" table="COMPOUND">
        <id name="id" type="int" column="COMPOUND_ID">
        </id>
        <property name="cid" type="string" column="COMPOUND_CID"/>
        <property name="SMILE" type="string" column="COMPOUND_SMILE"/>
       
    </class>
</hibernate-mapping>


But when I run my hibernate console, it says :

Code:
org.hibernate.MappingException: entity class not found: com.genebio.toxico.compound.CompoundImpl
  org.hibernate.MappingException: entity class not found: com.genebio.toxico.compound.CompoundImpl
  java.lang.ClassNotFoundException: com.genebio.toxico.compound.CompoundImpl


My file architecture is like that

src
->config.cfg.xml
->com.genebio.toxico.compound
->->CompoundImpl.java
->->CompoundImpl.hbm.xml


I cannot understant why it doesn't found the class, because the class exist... any idea ?


Top
 Profile  
 
 Post subject: Bad formated mapping file
PostPosted: Thu Mar 22, 2007 8:15 am 
Beginner
Beginner

Joined: Tue Dec 12, 2006 7:52 am
Posts: 20
Hi

I think you are not configured that mapping file in hibernate.cfg.xml file
<hibernate-configuration>
<session-factory name="sessionFactory">
.........................................................
.....................................................................
<!-- mapping file like this --->
<mapping resource="org/naru/mappings/Stud.hbm.xml"/>
</session-factory>
</hibernate-configuration>

You must mention the mapping file(hbm file)


(If this is helpful to please give the credits don't forget)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 1:09 pm 
Beginner
Beginner

Joined: Wed Mar 21, 2007 10:23 am
Posts: 20
I have done that modification, but I still obtain the same error...


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