RESOLVED - BATCH-971: add database writers to iosample

JPA iosample
This commit is contained in:
robokaso
2008-12-18 10:42:46 +00:00
parent 194cc1db69
commit dcb5111b70
6 changed files with 147 additions and 33 deletions

View File

@@ -18,30 +18,39 @@ package org.springframework.batch.sample.domain.trade;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "CUSTOMER")
public class CustomerCredit {
@Id
private int id;
private String name;
private BigDecimal credit;
public CustomerCredit(){
}
public CustomerCredit(int id, String name, BigDecimal credit){
private String name;
private BigDecimal credit;
public CustomerCredit() {
}
public CustomerCredit(int id, String name, BigDecimal credit) {
this.id = id;
this.name = name;
this.credit = credit;
}
public String toString() {
return "CustomerCredit [id=" + id +",name=" + name + ", credit=" + credit + "]";
}
return "CustomerCredit [id=" + id + ",name=" + name + ", credit=" + credit + "]";
}
public BigDecimal getCredit() {
return credit;
}
public BigDecimal getCredit() {
return credit;
}
public int getId() {
public int getId() {
return id;
}
@@ -50,31 +59,31 @@ public class CustomerCredit {
}
public void setCredit(BigDecimal credit) {
this.credit = credit;
}
this.credit = credit;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CustomerCredit increaseCreditBy(BigDecimal sum) {
CustomerCredit newCredit = new CustomerCredit();
newCredit.credit = this.credit.add(sum);
newCredit.name = this.name;
newCredit.id = this.id;
return newCredit;
}
public boolean equals(Object o) {
return (o instanceof CustomerCredit) && ((CustomerCredit)o).id==id;
public void setName(String name) {
this.name = name;
}
public CustomerCredit increaseCreditBy(BigDecimal sum) {
CustomerCredit newCredit = new CustomerCredit();
newCredit.credit = this.credit.add(sum);
newCredit.name = this.name;
newCredit.id = this.id;
return newCredit;
}
public boolean equals(Object o) {
return (o instanceof CustomerCredit) && ((CustomerCredit) o).id == id;
}
public int hashCode() {
return id;
}
}