|
181 | 181 | import org.graalvm.polyglot.HostAccess.Export;
|
182 | 182 | import org.hibernate.HibernateException;
|
183 | 183 | import org.hibernate.ObjectNotFoundException;
|
| 184 | +import org.hibernate.ScrollMode; |
184 | 185 | import org.hibernate.ScrollableResults;
|
185 | 186 | import org.hibernate.query.Query;
|
186 | 187 | import org.hibernate.Session;
|
| 188 | +import org.hibernate.StatelessSession; |
187 | 189 | import org.hibernate.exception.ConstraintViolationException;
|
188 | 190 | import org.quartz.SchedulerException;
|
189 | 191 | import org.slf4j.MarkerFactory;
|
@@ -7939,9 +7941,14 @@ public Response getDataXLSX(@Context HttpServletRequest request,
|
7939 | 7941 | deviceSheet.setAutoFilter(new CellRangeAddress(0, y, 0, x));
|
7940 | 7942 | }
|
7941 | 7943 |
|
7942 |
| - try (ScrollableResults<Device> scrollableDevices = deviceQuery.scroll()) { |
| 7944 | + try (ScrollableResults<Device> scrollableDevices = deviceQuery.scroll(ScrollMode.FORWARD_ONLY)) { |
| 7945 | + long previousDeviceId = -1; |
7943 | 7946 | while (scrollableDevices.next()) {
|
7944 | 7947 | Device device = scrollableDevices.get();
|
| 7948 | + if (device.getId() == previousDeviceId) { |
| 7949 | + continue; |
| 7950 | + } |
| 7951 | + previousDeviceId = device.getId(); |
7945 | 7952 | int x = -1;
|
7946 | 7953 | row = deviceSheet.createRow(++y);
|
7947 | 7954 | row.createCell(++x).setCellValue(device.getId());
|
@@ -8049,8 +8056,13 @@ public Response getDataXLSX(@Context HttpServletRequest request,
|
8049 | 8056 | }
|
8050 | 8057 |
|
8051 | 8058 | try (ScrollableResults<NetworkInterface> scrollableNetworkInterfaces = interfaceQuery.scroll()) {
|
| 8059 | + long previousNetworkInterfaceId = -1; |
8052 | 8060 | while (scrollableNetworkInterfaces.next()) {
|
8053 | 8061 | NetworkInterface networkInterface = scrollableNetworkInterfaces.get();
|
| 8062 | + if (networkInterface.getId() == previousNetworkInterfaceId) { |
| 8063 | + continue; |
| 8064 | + } |
| 8065 | + previousNetworkInterfaceId = networkInterface.getId(); |
8054 | 8066 | Device device = networkInterface.getDevice();
|
8055 | 8067 | if (networkInterface.getIpAddresses().isEmpty()) {
|
8056 | 8068 | row = interfaceSheet.createRow(++y);
|
@@ -8147,8 +8159,13 @@ public Response getDataXLSX(@Context HttpServletRequest request,
|
8147 | 8159 | inventorySheet.setAutoFilter(new CellRangeAddress(0, y, 0, x));
|
8148 | 8160 | }
|
8149 | 8161 | try (ScrollableResults<Module> scrollableModules = moduleQuery.scroll()) {
|
| 8162 | + long previousModuleId = -1; |
8150 | 8163 | while (scrollableModules.next()) {
|
8151 | 8164 | Module module = scrollableModules.get();
|
| 8165 | + if (module.getId() == previousModuleId) { |
| 8166 | + continue; |
| 8167 | + } |
| 8168 | + previousModuleId = module.getId(); |
8152 | 8169 | Device device = module.getDevice();
|
8153 | 8170 | int x = -1;
|
8154 | 8171 | row = inventorySheet.createRow(++y);
|
@@ -8221,7 +8238,6 @@ public Response getDataXLSX(@Context HttpServletRequest request,
|
8221 | 8238 | row.getCell(x).setCellStyle(datetimeCellStyle);
|
8222 | 8239 | row.createCell(++x).setCellValue(checkResult.getResult().toString());
|
8223 | 8240 | }
|
8224 |
| - session.clear(); |
8225 | 8241 | }
|
8226 | 8242 |
|
8227 | 8243 | if (exportGroups) {
|
|
0 commit comments