-->
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: Could not parse mapping document hbm.xml
PostPosted: Tue Jan 19, 2010 2:13 am 
Newbie

Joined: Tue Jan 19, 2010 1:54 am
Posts: 2
Hi All,

I am having user table with userid and password .

hibernate.cfg.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
   <session-factory>
      
      <property name="connection.characterEncoding">UTF-8</property>
      <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="connection.url">jdbc:mysql://localhost:3306/tricky</property>
      <property name="connection.username">root</property>
      <property name="connection.password">admin</property>
      
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      <!-- <property name="current_session_context_class">thread</property> -->
      <mapping resource="com/tricky/vo/User.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


User.hbm.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
   <class table="user" >
      <id name="username" column="userid" />   
      <property name="password" column="password" />
   </class>
</hibernate-mapping>


User.java

Code:
public class User {
   
   private String username;
   private String password;
   /**
    * @return the username
    */
   public String getUsername() {
      return username;
   }
   /**
    * @param username the username to set
    */
   public void setUsername(String username) {
      this.username = username;
   }
   /**
    * @return the password
    */
   public String getPassword() {
      return password;
   }
   /**
    * @param password the password to set
    */
   public void setPassword(String password) {
      this.password = password;
   }
   
}


in my class i am trying to call

Code:
HibernateUtil.createSessionFactory();


It was throwing
Code:
Could not parse mapping document from resource com/tricky/vo/User.hbm.xml


Could anyone, help me pleasee


Top
 Profile  
 
 Post subject: Re: Could not parse mapping document hbm.xml
PostPosted: Tue Jan 19, 2010 3:48 am 
Newbie

Joined: Tue Jan 19, 2010 1:54 am
Posts: 2
I got the answer .

I have missed
Quote:
name
attribute in hbm.xml


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.