Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
957accc3
Commit
957accc3
authored
Mar 05, 2015
by
Matija Obreza
Browse files
No Hibernate Stateless session
parent
2509c2d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/persistence/domain/dataset/DSRowRepositoryCustomImpl.java
View file @
957accc3
...
...
@@ -178,12 +178,8 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
@Override
public
List
<
Object
[]>
getRowValues
(
List
<
Long
>
rowIds
,
Long
[]
columnDescriptors
)
{
// LOG.info("Making stateless");
SessionFactory
sessionFactory
=
entityManager
.
getEntityManagerFactory
().
unwrap
(
SessionFactory
.
class
);
StatelessSession
session
=
sessionFactory
.
openStatelessSession
();
Transaction
tx
=
session
.
beginTransaction
();
org
.
hibernate
.
Query
q
=
session
.
createQuery
(
"select dsrv.datasetDescriptor.id, dsrv.row.id, dsrv from DSValue dsrv where dsrv.row.id in (:ids)"
);
q
.
setParameterList
(
"ids"
,
rowIds
);
Query
q
=
entityManager
.
createQuery
(
"select dsrv.datasetDescriptor.id, dsrv.row.id, dsrv from DSValue dsrv where dsrv.row.id in (:ids)"
);
q
.
setParameter
(
"ids"
,
rowIds
);
// LOG.info("Query ready");
// System.out.println("-");
...
...
@@ -192,18 +188,16 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
for
(
int
i
=
0
;
i
<
rowIds
.
size
();
i
++)
{
results
.
add
(
new
Object
[
columnDescriptors
.
length
]);
}
List
<
Object
[]>
values
=
q
.
getResultList
();
// List of [dsd.id, dsrv]
ScrollableResults
scroll
=
q
.
scroll
(
ScrollMode
.
FORWARD_ONLY
);
// LOG.info("Scrolling");
int
entries
=
0
;
while
(
scroll
.
next
())
{
entries
++;
Object
[]
v
=
scroll
.
get
();
for
(
Object
[]
v
:
values
)
{
// LOG.info("Got next");
Long
dsdId
=
(
Long
)
v
[
0
];
Long
rowId
=
(
Long
)
v
[
1
];
DSValue
<?>
dsv
=
(
DSValue
<?>)
v
[
2
];
entityManager
.
detach
(
dsv
);
Object
[]
result
=
results
.
get
(
rowIds
.
indexOf
(
rowId
));
for
(
int
i
=
0
;
i
<
columnDescriptors
.
length
;
i
++)
{
if
(
columnDescriptors
[
i
].
equals
(
dsdId
))
{
...
...
@@ -211,10 +205,6 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
}
}
}
// LOG.info("Done scrolling entries=" + entries);
tx
.
commit
();
session
.
close
();
// LOG.info("Closing session");
return
results
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
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 comment