-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate Invalid Mapping Exception due to invalid mapping
PostPosted: Mon Dec 19, 2011 9:57 am 
Newbie

Joined: Mon Dec 19, 2011 9:27 am
Posts: 1
Hi...i am implementing Spring mvc2.5 hibernate Example. In application I am trying to insert data into the table using hibernate. I am getting one error:Could not parse mapping document due to invalid mapping.I have added the <id>element .Eventhough i am getting the error.Please Suggest me a solution asap.


This is my mapping file:
<?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 name="com.data.UserBean" table="USERDET">

<id name="id" column="ID" type="int">
<generator class="increment"/>
</id>

<property name="userName" column="USERNAME" type="java.lang.String"/>
<property name="password" column="PASSWORD" type="java.lang.String"/>
</class>

</hibernate-mapping>

This is my application context file:

<?xml version="1.0"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/b ... ns-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/c ... xt-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/t ... tx-2.5.xsd">

<bean id="ViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"></property>

<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>


<bean name="/Userform.do" class="com.controller.Usercontroller">
<property name="commandName" value="user"/>
<property name="commandClass" value="com.data.UserBean"/>
<property name="formView" value="Userform"/>
<property name="successView" value="Sucess"/>
<property name="userservice" ref="refUserService"/>
</bean>


<bean id="refUserService" class="com.service.UserServiceImpl">
<property name="userDao" ref="refUserdao"/>
</bean>

<bean id="refUserdao" class="com.dao.UserDaoImpl">
<property name="sessionFactory"><ref bean="mySessionFactory"/></property>
</bean>



<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@cretojpbidbs01.comfin.ge.com:1521:APBISTG" />
<property name="username" value="ALBP_USER" />
<property name="password" value="ALBP_USER" />
</bean>

<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="dataSource"><ref bean="dataSource"/></property>

<property name="mappingLocations">
<list>
<value>classpath*:/com/data/user.hbm.xml</value>
</list>
</property>

<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>



<bean id="hibernatetransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="mySessionFactory" />
<property name="datasource" ref="datasource" />
</bean>

<bean id="hibernateDaoSupport" class="org.springframework.orm.hibernate3.support.HibernateDaoSupport">
<property name="SessionFactory" ref="mySessionFactory" />
</bean>

</beans>


This is my dao impl:
public void save(UserBean user)
{
getHibernateTemplate().save(user);
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.