java - org.hibernate.MappingException: <mapping> element in configuration specifies no known attributes -


when run code gives me exception:

org.hibernate.mappingexception: element in configuration specifies no known attributes

i not sure error occurs, can me solve this..

hibernate.cfg.xml

     <hibernate-configuration>      <session-factory>      <property name="hbm2ddl.auto">create</property> <property name="hibernate.dialect">org.hibernate.dialect.mysqldialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.driver</property> <property name="hibernate.connection.url">"url"</property> <property name="hibernate.connection.username">"username"</property> <property name="hibernate.connection.password">"password"</property> <mapping resource="student.hbm.xml"/> <mapping/> 

student.java

public class student {  private string name;  private int id;  public string getname() {     return name; }  public void setname(string name) {     this.name = name; }  public int getid() {     return id; }  public void setid(int id) {     this.id = id; }  }  regular.java   public class regular extends student {  string coursefees;  public string getcoursefees() {     return coursefees; }  public void setcoursefees(string coursefees) {     this.coursefees = coursefees; }  } 

distant.java

 public class distant extends student {  string distantfees;  public string getdistantfees() {     return distantfees; }  public void setdistantfees(string distantfees) {     this.distantfees = distantfees; }  } 

student.hbm.xml

       <!doctype hibernate-mapping public       "-//hibernate/hibernate mapping dtd 3.0//en"        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">         <hibernate-mapping>          <class name="pojos.student" table="student" discriminator-       value="student">          <id name="id" type="int">          <column name="id"/>        <generator class="increment"></generator>          </id>           <discriminator column="type" type="string"></discriminator>          <property name="name" type="string">        <column name="sname"/>         </property>       <subclass name="pojos.regular" discriminator-value="regstud">        <property name="coursefees" type="string">      <column name="coursefees"/>      </property>       </subclass>        <subclass name="pojos.distant" discriminator-value="distant">      <property name="distantfees" type="string">   <column name="distfees"/>   </property>     </subclass>   </class>   </hibernate-mapping> 

error:

exception in thread "main" org.hibernate.mappingexception: element in configuration specifies no known attributes @ org.hibernate.cfg.configuration.parsemappingelement(configuration.java:2286) @ org.hibernate.cfg.configuration.parsesessionfactory(configuration.java:2227) @ org.hibernate.cfg.configuration.doconfigure(configuration.java:2207) @ org.hibernate.cfg.configuration.doconfigure(configuration.java:2160) @ org.hibernate.cfg.configuration.configure(configuration.java:2075)

remove empty <mapping/> @ end of hibernate.cfg.xml file


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -