Skip to content
GitLab
Menu
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 {
...
@@ -178,12 +178,8 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
@Override
@Override
public
List
<
Object
[]>
getRowValues
(
List
<
Long
>
rowIds
,
Long
[]
columnDescriptors
)
{
public
List
<
Object
[]>
getRowValues
(
List
<
Long
>
rowIds
,
Long
[]
columnDescriptors
)
{
// LOG.info("Making stateless");
Query
q
=
entityManager
.
createQuery
(
"select dsrv.datasetDescriptor.id, dsrv.row.id, dsrv from DSValue dsrv where dsrv.row.id in (:ids)"
);
SessionFactory
sessionFactory
=
entityManager
.
getEntityManagerFactory
().
unwrap
(
SessionFactory
.
class
);
q
.
setParameter
(
"ids"
,
rowIds
);
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
);
// LOG.info("Query ready");
// LOG.info("Query ready");
// System.out.println("-");
// System.out.println("-");
...
@@ -192,18 +188,16 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
...
@@ -192,18 +188,16 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
for
(
int
i
=
0
;
i
<
rowIds
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
rowIds
.
size
();
i
++)
{
results
.
add
(
new
Object
[
columnDescriptors
.
length
]);
results
.
add
(
new
Object
[
columnDescriptors
.
length
]);
}
}
List
<
Object
[]>
values
=
q
.
getResultList
();
// List of [dsd.id, dsrv]
// List of [dsd.id, dsrv]
ScrollableResults
scroll
=
q
.
scroll
(
ScrollMode
.
FORWARD_ONLY
);
for
(
Object
[]
v
:
values
)
{
// LOG.info("Scrolling");
int
entries
=
0
;
while
(
scroll
.
next
())
{
entries
++;
Object
[]
v
=
scroll
.
get
();
// LOG.info("Got next");
// LOG.info("Got next");
Long
dsdId
=
(
Long
)
v
[
0
];
Long
dsdId
=
(
Long
)
v
[
0
];
Long
rowId
=
(
Long
)
v
[
1
];
Long
rowId
=
(
Long
)
v
[
1
];
DSValue
<?>
dsv
=
(
DSValue
<?>)
v
[
2
];
DSValue
<?>
dsv
=
(
DSValue
<?>)
v
[
2
];
entityManager
.
detach
(
dsv
);
Object
[]
result
=
results
.
get
(
rowIds
.
indexOf
(
rowId
));
Object
[]
result
=
results
.
get
(
rowIds
.
indexOf
(
rowId
));
for
(
int
i
=
0
;
i
<
columnDescriptors
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnDescriptors
.
length
;
i
++)
{
if
(
columnDescriptors
[
i
].
equals
(
dsdId
))
{
if
(
columnDescriptors
[
i
].
equals
(
dsdId
))
{
...
@@ -211,10 +205,6 @@ public class DSRowRepositoryCustomImpl implements DSRowCustomRepository {
...
@@ -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
;
return
results
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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