Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a6564930
authored
Mar 09, 2010
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added precision and scale to BigDecimal fields.
1 parent
fd845e2e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
code/LanBortal/EarContent/lib/LanBortalDatabase.jar
code/LanBortalDatabase/src/fi/insomnia/bortal/model/AccountEvent.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/BillLine.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LogEntry.java
code/LanBortal/EarContent/lib/LanBortalDatabase.jar
View file @
a656493
No preview for this file type
code/LanBortalDatabase/src/fi/insomnia/bortal/model/AccountEvent.java
View file @
a656493
...
@@ -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
)
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/BillLine.java
View file @
a656493
...
@@ -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
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LogEntry.java
View file @
a656493
...
@@ -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
(
T
emporalType
.
T
IMESTAMP
)
@Temporal
(
TIMESTAMP
)
private
Calendar
time
=
Calendar
.
getInstance
();
private
Calendar
time
=
Calendar
.
getInstance
();
@Lob
@Lob
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment