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 e0a7dcf7
authored
Apr 01, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add batchFetch for fetching place references. Speeds up init considerably
1 parent
9914e624
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
code/moya-database/src/main/java/fi/codecrew/moya/model/Place.java
code/moya-database/src/main/java/fi/codecrew/moya/model/Place.java
View file @
e0a7dcf
...
...
@@ -32,6 +32,9 @@ import javax.persistence.Temporal;
import
javax.persistence.TemporalType
;
import
javax.persistence.Transient
;
import
org.eclipse.persistence.annotations.BatchFetch
;
import
org.eclipse.persistence.annotations.BatchFetchType
;
import
fi.codecrew.moya.utilities.NumericStringComparator
;
/**
...
...
@@ -69,6 +72,7 @@ public class Place extends GenericEntity implements Comparable<Place> {
private
String
code
=
""
;
@OneToOne
(
mappedBy
=
"placeReservation"
)
@BatchFetch
(
BatchFetchType
.
EXISTS
)
private
GroupMembership
placeReserver
;
@Column
(
name
=
"buyable"
,
nullable
=
false
)
...
...
@@ -104,6 +108,11 @@ public class Place extends GenericEntity implements Comparable<Place> {
@ManyToOne
private
EventUser
currentUser
;
@OneToOne
(
mappedBy
=
"place"
)
@JoinColumn
(
nullable
=
true
)
@BatchFetch
(
BatchFetchType
.
EXISTS
)
private
PlaceSlot
reserverSlot
;
public
static
enum
PlaceState
{
FREE
,
DISABLED
,
LOCKED
,
TEMP_RESERVED_FORME
,
MY_PLACE
,
RESERVED
...
...
@@ -138,10 +147,6 @@ public class Place extends GenericEntity implements Comparable<Place> {
return
ret
;
}
@OneToOne
(
mappedBy
=
"place"
)
@JoinColumn
(
nullable
=
true
)
private
PlaceSlot
reserverSlot
;
public
Place
()
{
super
();
}
...
...
@@ -311,6 +316,7 @@ public class Place extends GenericEntity implements Comparable<Place> {
/**
* NOTE: you can newer be sure that this is up to date
*
* @return
*/
public
PlaceSlot
getReserverSlot
()
{
...
...
@@ -361,13 +367,13 @@ public class Place extends GenericEntity implements Comparable<Place> {
if
(
this
.
getName
()
==
null
||
o
.
getName
()
==
null
)
{
if
(
this
.
getName
()
==
null
)
{
return
1
;
}
}
if
(
o
.
getName
()
==
null
)
{
return
-
1
;
}
return
-
1
;
}
// both names are null. Compare IDs
return
this
.
getNonNullId
().
compareTo
(
o
.
getNonNullId
());
}
}
if
(
this
.
getName
().
equals
(
o
.
getName
()))
{
return
0
;
...
...
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