-->
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: SaveOrUpdat is not working Oracle Help me to fix the error ?
PostPosted: Fri May 31, 2013 9:35 am 
Newbie

Joined: Thu Dec 13, 2012 2:31 am
Posts: 3
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...


Top
 Profile  
 
 Post subject: Re: SaveOrUpdat is not working Oracle Help me to fix the error ?
PostPosted: Sat Jun 01, 2013 12:51 am 
Newbie

Joined: Thu Dec 13, 2012 2:31 am
Posts: 3
Thank for your Reply knightblue

i tried session.flush() and close() but no improvement. Still i'm not able to saveorUpdate data into the database.
it does not showing ERROR.


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.