При добавление в таблицу Сustomera бросает следующую ошибку
"ava.sql.SQLIntegrityConstraintViolationException: Column 'Ferst_name' cannot be null"
SQL запрос
"Insert into Customer (Ferst_name, Last_name, Phone, E_mail, Sex, Address, Password, Nick) values (?, ?, ?, ?, ?, ?, ?, ?)"
вот класс в котором реализуется метод "add"
package com.homeShop.dao;
import com.homeShop.PropertiesSetSample;
import com.homeShop.customer.ConnectionUtil;
import com.homeShop.customer.Customer;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.*;
import java.util.List;
public class CustomerDaoImpl implements GenericDao<Customer, Intege> {
PropertiesSetSample propertiesSetSample = new PropertiesSetSample();
Connection connection;
public CustomerDaoImpl() throws SQLException, FileNotFoundException {
connection = ConnectionUtil.getConnection();
}
@Override
public Customer add(Customer customer) {
customer = new Customer();
PreparedStatement ps;
try {
ps = connection.prepareStatement(propertiesSetSample.setSample("addCustomer"));
connection.setAutoCommit(false);
ps.setString(1, customer.getFirstName());
ps.setString(2, customer.getLastName());
ps.setInt(3, customer.getPhone());
ps.setString(4, customer.getEMail());
ps.setString(5, customer.getSex());
ps.setString(6, customer.getAddress());
ps.setString(7, customer.getPassword());
ps.setString(8, customer.getNick());
ps.executeUpdate();
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return customer;
}
// Класс main что бы быстро проверить работу метода
public static void main(String[] args) throws FileNotFoundException, SQLException {
Customer customer = new Customer("Max", "Tom", 986594539, "Tom_titan@gmail.com", "Man", "Vishgorod, mazepi 10",
"52364xcc", "MaxTom");
/*System.out.println(customer.toString());*/
CustomerDaoImpl customerDao = new CustomerDaoImpl();
customerDao.add(customer);
}
}
Класс Customer
package com.homeShop.customer;
import lombok.Data;
@Data
public class Customer {
private int id;
private String firstName;
private String lastName;
private int phone;
private String eMail;
private String sex;
private String address;
private String password;
private String nick;
public Customer() {
}
public Customer(String firstName, String lastName, int phone, String eMail, String sex, String address, String password, String nick) {
this.firstName = firstName;
this.lastName = lastName;
this.phone = phone;
this.eMail = eMail;
this.sex = sex;
this.address = address;
this.password = password;
this.nick = nick;
}
}
Заранее благодарю за ответы