1 Replies - 3330 Views - Last Post: 29 January 2014 - 09:32 AM

#1 bita  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 190
  • Joined: 21-April 09

update query

Posted 29 January 2014 - 03:47 AM

Hi all,

I have a specific class of person information as below, I want to know does my query work right as what I stated in class:

public class PersonInfo {

    private String firstName;
    private String lastName;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
}



And the query in the method:

public void update(PersonInfo personInfo) throws SQLException {
        preparedStatement = connection.prepareStatement("UPDATE PERSON SET personInfo.firstName = ? WHERE personInfo.lastName = ?");
//...



Should I use 'personInfo.firstName' or 'firstName' would be suffice ?

Thanks in advance.

Bita

Is This A Good Question/Topic? 0
  • +

Replies To: update query

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10477
  • View blog
  • Posts: 38,835
  • Joined: 27-December 08

Re: update query

Posted 29 January 2014 - 09:32 AM

You can just use the table's field names without using the table name. By the way- if the table is named PERSONS, you can't identify the fields using personInfo.fieldName.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1