Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: HQL Update

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default HQL Update

    Hello guys.. I don't know if this is the right place to be asking this question, but i need to know what's wrong with my HQL Update statement.. I am using Eclipse IDE with jboss server and below is my code for the update statement.. when i debug my program, the update statement don't get execute and it gives me something like this : ERROR [PARSER] line 1:88: expecting EQ, found ':'

    public boolean updateEmployee(EmployeeDTO dto) {
     
    		boolean isSuccess = false;
    		Session sess = getSession();
     
    		Transaction tx = null;
    		try {
     
    			tx = sess.beginTransaction();
     
    			int empId = dto.getEmpId();
    			String firstName = dto.getFirstName();
    			String lastName = dto.getLastName();
    			String email = dto.getEmail();
     
    			Query query = sess
    					.createQuery("update EmployeeDTO set firstName = :firstName, lastName = :lastName, email :email"
    							+ "where empId = :empId");
    			query.setParameter("empId", empId);
    			query.setParameter("firstName", firstName);
    			query.setParameter("lastName", lastName);
    			query.setParameter("email", email);
    			query.executeUpdate();
    			tx.commit();
    			isSuccess = true;
     
    		} catch (Exception e) {
    			isSuccess = false;
    			if (tx != null)
    				tx.rollback();
    		} finally {
    			sess.close();
    		}
     
    		return isSuccess;
     
    	}
    Last edited by smartshahezad; July 30th, 2014 at 04:05 PM.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: HQL Update

    Please post your code using code or highlight tags as explained near the top of this topic.

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Re: HQL Update

    Quote Originally Posted by GregBrannon View Post
    Please post your code using code or highlight tags as explained near the top of this topic.
    edited..

Similar Threads

  1. Hql difference query native
    By Leone in forum JDBC & Databases
    Replies: 0
    Last Post: February 26th, 2014, 09:15 AM
  2. Update problem
    By dannynoogen in forum What's Wrong With My Code?
    Replies: 7
    Last Post: May 23rd, 2013, 03:58 PM
  3. Update Array by explode()
    By docco in forum Other Programming Languages
    Replies: 4
    Last Post: January 28th, 2013, 10:56 AM
  4. Why, won't this update?
    By Jerba in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 5th, 2012, 09:06 PM