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 4cdd2643
authored
Aug 31, 2013
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DBModelFacade returning multiple last revisions :)
1 parent
519484ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/DBModelFacade.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/DBModelFacade.java
View file @
4cdd264
...
...
@@ -5,6 +5,7 @@ import javax.ejb.Stateless;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.Query
;
import
javax.persistence.TypedQuery
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
...
...
@@ -39,7 +40,9 @@ public class DBModelFacade extends GenericFacade<DBModel> {
CriteriaQuery
<
DBModel
>
cq
=
cb
.
createQuery
(
DBModel
.
class
);
Root
<
DBModel
>
root
=
cq
.
from
(
DBModel
.
class
);
cq
.
orderBy
(
cb
.
desc
(
root
.
get
(
DBModel_
.
revision
)));
return
getSingleNullableResult
(
getEm
().
createQuery
(
cq
));
TypedQuery
<
DBModel
>
q
=
getEm
().
createQuery
(
cq
);
q
.
setMaxResults
(
1
);
return
getSingleNullableResult
(
q
);
}
@PersistenceContext
...
...
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