Changed Contract.date from String to Date
Changed Contract.date from String to Date
This commit is contained in:
parent
82c8df3e5c
commit
85010e6025
|
@ -11,6 +11,7 @@ import de.dis2017.data.TenancyContract;
|
|||
import de.dis2017.data.db.ORM;
|
||||
import de.dis2017.data.db.Type;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -144,7 +145,7 @@ public class Main {
|
|||
printListOfPersons();
|
||||
contract.setPerson(FormUtil.readInt("Person"));
|
||||
contract.setPlace(FormUtil.readString("Place"));
|
||||
contract.setDate(FormUtil.readString("Date"));
|
||||
contract.setDate(Date.valueOf(FormUtil.readString("Date")));
|
||||
if(_orm.isApartment(contract.getEstate())){
|
||||
TenancyContract tenContract = new TenancyContract(contract);
|
||||
System.out.println("Start Date:");
|
||||
|
|
|
@ -2,11 +2,11 @@ package de.dis2017.data;
|
|||
/**
|
||||
* Contract data class
|
||||
*/
|
||||
import java.util.Date;
|
||||
import java.sql.Date;
|
||||
|
||||
public class Contract {
|
||||
private int contractNo = -1;
|
||||
private String date;
|
||||
private Date date;
|
||||
private String place;
|
||||
private int person;
|
||||
private int estate;
|
||||
|
@ -24,10 +24,10 @@ public class Contract {
|
|||
public void setContractNo(int contractNo) {
|
||||
this.contractNo = contractNo;
|
||||
}
|
||||
public String getDate() {
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
public void setDate(String date) {
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
public String getPlace() {
|
||||
|
|
|
@ -664,7 +664,7 @@ public class ORM {
|
|||
String insertSQL = "INSERT INTO CONTRACT (date, place) " +
|
||||
"VALUES (?, ?)";
|
||||
PreparedStatement pstmt = _connection.prepareStatement(insertSQL, Statement.RETURN_GENERATED_KEYS);
|
||||
pstmt.setString(1, contract.getDate());
|
||||
pstmt.setDate(1, contract.getDate());
|
||||
pstmt.setString(2, contract.getPlace());
|
||||
pstmt.executeUpdate();
|
||||
|
||||
|
@ -707,7 +707,7 @@ public class ORM {
|
|||
// create query
|
||||
String updateSQL = "UPDATE CONTRACT SET date = ?, place = ? WHERE ContractNumber = ?";
|
||||
PreparedStatement pstmt = _connection.prepareStatement(updateSQL);
|
||||
pstmt.setString(1, contract.getDate());
|
||||
pstmt.setDate(1, contract.getDate());
|
||||
pstmt.setString(2, contract.getPlace());
|
||||
pstmt.setInt(3, contract.getContractNo());
|
||||
|
||||
|
|
Loading…
Reference in New Issue