Search Results

Search found 1 results on 1 pages for 'chinni'.

Page 1/1 | 1 

  • Copy not null and not empty fields from one object to another object of the same type(Objects are same type) in java

    - by Chinni
    I am using hibernate, struts, extjs in my project. I have a Customer object with these fields: custId, custName, address, phone and in my project from UI side I get an object customer with custName. So I need to update the above object(custName is unique). I have only one object with the same customer name. So I will get that object using customer name (object from DB). Now I have to save the object with the updated customer name. If I save as follows I have Customer Object from UI, is cust Customer cust1 = getCustomerByName(cust.getCustName()); cust.setCustId(cust1.getCustId()); save(cust); If I do this I lose the customer address and phone number. So, how can I copy one object not null or not empty field values to another object of same type. Can any one please help. I just stuck here. It's stopping me to save. Thanks in advance!

    Read the article

1