Commit a6564930 by Tuomas Riihimäki

Added precision and scale to BigDecimal fields.

1 parent fd845e2e
...@@ -44,10 +44,10 @@ public class AccountEvent implements ModelInterface { ...@@ -44,10 +44,10 @@ public class AccountEvent implements ModelInterface {
@Column(name = "account_events_id", nullable = false) @Column(name = "account_events_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "unit_price", nullable = false) @Column(name = "unit_price", nullable = false, precision=24,scale=4)
private BigDecimal unitPrice; private BigDecimal unitPrice;
@Column(name = "unit_count", nullable = false) @Column(name = "unit_count", nullable = false, precision=24,scale=4)
private BigDecimal units; private BigDecimal units;
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
......
...@@ -32,6 +32,7 @@ import javax.persistence.Version; ...@@ -32,6 +32,7 @@ import javax.persistence.Version;
@NamedQuery(name = "BillLine.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") }) @NamedQuery(name = "BillLine.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") })
public class BillLine implements ModelInterface { public class BillLine implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final BigDecimal DEFAULT_VAT = new BigDecimal(0.22);
@Id @Id
@GeneratedValue(strategy=GenerationType.IDENTITY) @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "bill_lines_id", nullable = false) @Column(name = "bill_lines_id", nullable = false)
...@@ -40,14 +41,14 @@ public class BillLine implements ModelInterface { ...@@ -40,14 +41,14 @@ public class BillLine implements ModelInterface {
@Column(name = "name", nullable = false) @Column(name = "name", nullable = false)
private String name; private String name;
@Column(name = "units", nullable = false) @Column(name = "units", nullable = false, precision=24,scale=4)
private BigDecimal units; private BigDecimal units;
@Column(name = "unit_price", nullable = false) @Column(name = "unit_price", nullable = false, precision=24,scale=4)
private BigDecimal unitPrice; private BigDecimal unitPrice;
@Column(name = "vat", nullable = false, columnDefinition = "numeric default 0.22") @Column(name = "vat", nullable = false,precision=3,scale=2, columnDefinition = "numeric(3,2) default 0.22")
private BigDecimal vat; private BigDecimal vat=DEFAULT_VAT;
@JoinColumn(name = "bills_id", referencedColumnName = "bills_id") @JoinColumn(name = "bills_id", referencedColumnName = "bills_id")
@ManyToOne @ManyToOne
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import static javax.persistence.TemporalType.TIMESTAMP;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -18,7 +20,6 @@ import javax.persistence.NamedQueries; ...@@ -18,7 +20,6 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version; import javax.persistence.Version;
/** /**
...@@ -40,7 +41,7 @@ public class LogEntry implements ModelInterface { ...@@ -40,7 +41,7 @@ public class LogEntry implements ModelInterface {
private Integer id; private Integer id;
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TIMESTAMP)
private Calendar time = Calendar.getInstance(); private Calendar time = Calendar.getInstance();
@Lob @Lob
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!