No ERROR thrown But no data is updating or saving in database
after i submit it going to success page.
But no data is saving in database. Please Help me to resolve this error.
application.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="appDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName" value="java:comp/env/jdbc/OnlineDataSource"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" lazy-init="true">
<property name="dataSource">
<ref bean="appDataSource" />
</property>
<property name="annotatedClasses" ref="annotatedClasses"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.default_schema">JTS</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
</props>
</property>
</bean>
<bean id="annotatedClasses" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<value>com.dash.dto.User</value>
</list>
</property>
</bean>
<bean id="userDao" class="com.dash.dao.UserDaoImpl">
<constructor-arg ref="sessionFactory"/>
</bean>
<bean id="service" class="com.dash.services.ServiceImpl">
<property name="userDao" ref="userDao"/>
</bean>
</beans>
User.java
Code:
package com.isisinfotech.etmsBilling.dto;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="DASHUSER" ,schema = "JTS")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="USERID",unique = true, nullable = false)
private long id;
@Column(name="USERNAME",unique=true )
private String username;
@Column (name="PASSWORD")
private String password;
@Column(name="FIRSTNAME")
private String firstname;
@Column(name="LASTNAME")
private String lastname;
/**
* @return the id
*/
public long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(long id) {
this.id = id;
}
/**
* @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;
}
/**
* @return the firstname
*/
public String getFirstname() {
return firstname;
}
/**
* @param firstname the firstname to set
*/
public void setFirstname(String firstname) {
this.firstname = firstname;
}
/**
* @return the lastname
*/
public String getLastname() {
return lastname;
}
/**
* @param lastname the lastname to set
*/
public void setLastname(String lastname) {
this.lastname = lastname;
}
}
userDAOImpl.java
Code:
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.dash.dto.User;
public class UserDaoImpl implements UserDao{
private SessionFactory sessionFactory;
public UserDaoImpl(SessionFactory sessionFactory)
{
this.sessionFactory = sessionFactory;
}
protected Session getSession()
{
return sessionFactory.openSession();//.getCurrentSession();
}
@Override
public void createUser(User user) {
System.out.println("Create User in DAOIMPL..");
getSession().saveOrUpdate(user);
}
}
It is creating tis Query
Code:
Hibernate:
select
user_.USERID,
user_.FIRSTNAME as FIRSTNAME0_,
user_.LASTNAME as LASTNAME0_,
user_.PASSWORD as PASSWORD0_,
user_.USERNAME as USERNAME0_
from
JTS.DASHUSER user_
where
user_.USERID=?
if i see in Oracle 11g there is no update or save
please Help me to resolve i struck with this error for two days...