├── pom.xml └── src ├── main ├── java │ └── com │ │ └── cortez │ │ └── samples │ │ ├── .DS_Store │ │ └── jpaperformance │ │ ├── bean │ │ ├── LazyBean.java │ │ └── PerformanceBean.java │ │ └── data │ │ ├── DepartmentEntity.java │ │ ├── EmployeeEntity.java │ │ └── LazyEntity.java └── resources │ └── META-INF │ └── persistence.xml └── test └── java └── com └── cortez └── samples └── jpaperformance └── bean ├── LazyBeanTest.java └── PerformanceBeanTest.java /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.cortez.samples 6 | jpa-performance 7 | 1.0-SNAPSHOT 8 | war 9 | 10 | jpa-performance 11 | 12 | 13 | 3.1.0 14 | 15 | 16 | 17 | 18 | UTF-8 19 | 1.7 20 | 21 | 22 | 3.1 23 | 1.3.1 24 | 25 | 26 | 8.0.0.Final 27 | 1.1.1.Final 28 | 29 | 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-compiler-plugin 35 | ${version.plugin.compiler} 36 | 37 | ${java.version} 38 | ${java.version} 39 | true 40 | true 41 | 42 | 43 | 44 | 45 | org.apache.maven.plugins 46 | maven-enforcer-plugin 47 | ${version.plugin.enforcer} 48 | 49 | 50 | enforce-maven 51 | 52 | enforce 53 | 54 | 55 | 56 | 57 | [${java.version},1.8) 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | org.apache.maven.plugins 67 | maven-war-plugin 68 | 2.4 69 | 70 | false 71 | 72 | 73 | 74 | 75 | org.zeroturnaround 76 | jrebel-maven-plugin 77 | 78 | 79 | generate-rebel-xml 80 | process-resources 81 | 82 | generate 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | org.jboss.arquillian 94 | arquillian-bom 95 | ${arquillian.version} 96 | import 97 | pom 98 | 99 | 100 | 101 | 102 | 103 | 104 | javax 105 | javaee-api 106 | 7.0 107 | provided 108 | 109 | 110 | 111 | org.apache.commons 112 | commons-lang3 113 | 3.1 114 | 115 | 116 | 117 | commons-beanutils 118 | commons-beanutils 119 | 1.8.3 120 | 121 | 122 | 123 | org.jboss.arquillian.junit 124 | arquillian-junit-container 125 | test 126 | 127 | 128 | 129 | org.jboss.shrinkwrap.resolver 130 | shrinkwrap-resolver-impl-maven 131 | test 132 | jar 133 | 134 | 135 | 136 | org.jboss.shrinkwrap.resolver 137 | shrinkwrap-resolver-impl-maven-archive 138 | test 139 | 140 | 141 | 142 | junit 143 | junit 144 | 4.11 145 | test 146 | 147 | 148 | 149 | 150 | 151 | wildfly-remote-arquillian 152 | 153 | 154 | org.wildfly 155 | wildfly-arquillian-container-remote 156 | ${wildfly.version} 157 | test 158 | 159 | 160 | 161 | 162 | glassfish-remote-arquillian 163 | 164 | 165 | org.jboss.arquillian.container 166 | arquillian-glassfish-remote-3.1 167 | 1.0.0.CR4 168 | test 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /src/main/java/com/cortez/samples/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/radcortez/jpa-performance/f94844565bd7462149aec6ae8d1a694ecc278966/src/main/java/com/cortez/samples/.DS_Store -------------------------------------------------------------------------------- /src/main/java/com/cortez/samples/jpaperformance/bean/LazyBean.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.bean; 2 | 3 | import com.cortez.samples.jpaperformance.data.LazyEntity; 4 | 5 | import javax.annotation.PostConstruct; 6 | import javax.ejb.Singleton; 7 | import javax.persistence.EntityManager; 8 | import javax.persistence.PersistenceContext; 9 | 10 | /** 11 | * @author Roberto Cortez 12 | */ 13 | @Singleton 14 | public class LazyBean { 15 | @PersistenceContext 16 | private EntityManager entityManager; 17 | 18 | @PostConstruct 19 | public void init() { 20 | LazyEntity lazyEntity = new LazyEntity(); 21 | lazyEntity.setId(1L); 22 | lazyEntity.setProperty01("01"); 23 | lazyEntity.setProperty02("02"); 24 | lazyEntity.setProperty03("03"); 25 | lazyEntity.setProperty04("04"); 26 | lazyEntity.setProperty05("05"); 27 | lazyEntity.setProperty06("06"); 28 | lazyEntity.setProperty07("07"); 29 | lazyEntity.setProperty08("08"); 30 | lazyEntity.setProperty09("09"); 31 | lazyEntity.setProperty10("10"); 32 | entityManager.persist(lazyEntity); 33 | entityManager.flush(); 34 | entityManager.clear(); 35 | } 36 | 37 | public LazyEntity find(Long id) { 38 | return entityManager.find(LazyEntity.class, id); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/cortez/samples/jpaperformance/bean/PerformanceBean.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.bean; 2 | 3 | import com.cortez.samples.jpaperformance.data.DepartmentEntity; 4 | import com.cortez.samples.jpaperformance.data.EmployeeEntity; 5 | import org.apache.commons.beanutils.BeanUtils; 6 | 7 | import javax.annotation.PostConstruct; 8 | import javax.ejb.Singleton; 9 | import javax.persistence.EntityManager; 10 | import javax.persistence.PersistenceContext; 11 | import javax.persistence.Query; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * @author Roberto Cortez 17 | */ 18 | @Singleton 19 | public class PerformanceBean { 20 | @PersistenceContext 21 | private EntityManager entityManager; 22 | 23 | @PostConstruct 24 | public void init() { 25 | for (int i = 1; i <= 2000; i++) { 26 | System.out.println("Inserting record " + i); 27 | DepartmentEntity departmentEntity = new DepartmentEntity(); 28 | departmentEntity.setId((long) i); 29 | 30 | for (int j = 1; j <= 100; j++) { 31 | try { 32 | BeanUtils.setProperty(departmentEntity, "property" + j, "abcdefghijklmno"); 33 | } catch (Exception e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | 39 | departmentEntity.setEmployees(new ArrayList()); 40 | for (int j = 1; j <= 2; j++) { 41 | EmployeeEntity employeeEntity = new EmployeeEntity(); 42 | employeeEntity.setId((long) (i * 10 - 10 + j)); 43 | 44 | for (int k = 1; k <= 100; k++) { 45 | try { 46 | BeanUtils.setProperty(employeeEntity, 47 | "property" + k, 48 | "abcdefghijklmno"); 49 | } catch (Exception e) { 50 | e.printStackTrace(); 51 | } 52 | } 53 | 54 | employeeEntity.setDepartmentEntity(departmentEntity); 55 | departmentEntity.getEmployees().add(employeeEntity); 56 | } 57 | 58 | entityManager.persist(departmentEntity); 59 | entityManager.flush(); 60 | } 61 | } 62 | 63 | public Long count() { 64 | return (Long) entityManager.createQuery("select count(p) from DepartmentEntity p").getSingleResult(); 65 | } 66 | 67 | @SuppressWarnings("unchecked") 68 | public List findAll() { 69 | return entityManager.createQuery("select p from DepartmentEntity p").getResultList(); 70 | } 71 | 72 | @SuppressWarnings("unchecked") 73 | public List findAllNeededColumns() { 74 | return entityManager.createQuery("select p.id, p.property01, p.property02, p.property03, p.property04, " + 75 | "p.property05, p.property06, p.property07, p.property08, p.property09, " + 76 | "p.property10 from DepartmentEntity p").getResultList(); 77 | } 78 | 79 | @SuppressWarnings("unchecked") 80 | public List findAllNeededColumnsPaginated() { 81 | Query query = 82 | entityManager.createQuery("select p.id, p.property01, p.property02, p.property03, p.property04, " + 83 | "p.property05, p.property06, p.property07, p.property08, p.property09, " + 84 | "p.property10 from DepartmentEntity p"); 85 | query.setFirstResult(1); 86 | query.setMaxResults(20); 87 | return query.getResultList(); 88 | } 89 | 90 | @SuppressWarnings("unchecked") 91 | public List findAllEager() { 92 | Query query = entityManager.createQuery("select p from DepartmentEntity p"); 93 | query.setHint("javax.persistence.fetchgraph", entityManager.getEntityGraph("departmentWithEmployees")); 94 | return query.getResultList(); 95 | } 96 | 97 | public List findAllLazy() { 98 | List all = findAll(); 99 | for (DepartmentEntity departmentEntity : all) { 100 | List employeeEntities = 101 | departmentEntity.getEmployees(); 102 | System.out.println(employeeEntities.size()); 103 | } 104 | return all; 105 | } 106 | 107 | @SuppressWarnings("unchecked") 108 | public List findAllFetchLazy() { 109 | return entityManager.createQuery( 110 | "select p from DepartmentEntity p left join fetch p.employees").getResultList(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/com/cortez/samples/jpaperformance/data/DepartmentEntity.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.data; 2 | 3 | import javax.persistence.*; 4 | import java.util.List; 5 | 6 | /** 7 | * Simple entity. 8 | * 9 | * @author Roberto Cortez 10 | */ 11 | @Entity 12 | @NamedEntityGraphs({ 13 | @NamedEntityGraph(name = "departmentWithEmployees", attributeNodes = {@NamedAttributeNode("employees")}) 14 | }) 15 | public class DepartmentEntity { 16 | @Id 17 | private Long id; 18 | private String property01; 19 | private String property02; 20 | private String property03; 21 | private String property04; 22 | private String property05; 23 | private String property06; 24 | private String property07; 25 | private String property08; 26 | private String property09; 27 | private String property10; 28 | private String property11; 29 | private String property12; 30 | private String property13; 31 | private String property14; 32 | private String property15; 33 | private String property16; 34 | private String property17; 35 | private String property18; 36 | private String property19; 37 | private String property20; 38 | private String property21; 39 | private String property22; 40 | private String property23; 41 | private String property24; 42 | private String property25; 43 | private String property26; 44 | private String property27; 45 | private String property28; 46 | private String property29; 47 | private String property30; 48 | private String property31; 49 | private String property32; 50 | private String property33; 51 | private String property34; 52 | private String property35; 53 | private String property36; 54 | private String property37; 55 | private String property38; 56 | private String property39; 57 | private String property40; 58 | private String property41; 59 | private String property42; 60 | private String property43; 61 | private String property44; 62 | private String property45; 63 | private String property46; 64 | private String property47; 65 | private String property48; 66 | private String property49; 67 | private String property50; 68 | private String property51; 69 | private String property52; 70 | private String property53; 71 | private String property54; 72 | private String property55; 73 | private String property56; 74 | private String property57; 75 | private String property58; 76 | private String property59; 77 | private String property60; 78 | private String property61; 79 | private String property62; 80 | private String property63; 81 | private String property64; 82 | private String property65; 83 | private String property66; 84 | private String property67; 85 | private String property68; 86 | private String property69; 87 | private String property70; 88 | private String property71; 89 | private String property72; 90 | private String property73; 91 | private String property74; 92 | private String property75; 93 | private String property76; 94 | private String property77; 95 | private String property78; 96 | private String property79; 97 | private String property80; 98 | private String property81; 99 | private String property82; 100 | private String property83; 101 | private String property84; 102 | private String property85; 103 | private String property86; 104 | private String property87; 105 | private String property88; 106 | private String property89; 107 | private String property90; 108 | private String property91; 109 | private String property92; 110 | private String property93; 111 | private String property94; 112 | private String property95; 113 | private String property96; 114 | private String property97; 115 | private String property98; 116 | private String property99; 117 | private String property100; 118 | 119 | @OneToMany(mappedBy = "departmentEntity", cascade = CascadeType.ALL) 120 | private List employees; 121 | 122 | public Long getId() { 123 | return id; 124 | } 125 | 126 | public void setId(Long id) { 127 | this.id = id; 128 | } 129 | 130 | public String getProperty01() { 131 | return property01; 132 | } 133 | 134 | public void setProperty01(String property01) { 135 | this.property01 = property01; 136 | } 137 | 138 | public String getProperty02() { 139 | return property02; 140 | } 141 | 142 | public void setProperty02(String property02) { 143 | this.property02 = property02; 144 | } 145 | 146 | public String getProperty03() { 147 | return property03; 148 | } 149 | 150 | public void setProperty03(String property03) { 151 | this.property03 = property03; 152 | } 153 | 154 | public String getProperty04() { 155 | return property04; 156 | } 157 | 158 | public void setProperty04(String property04) { 159 | this.property04 = property04; 160 | } 161 | 162 | public String getProperty05() { 163 | return property05; 164 | } 165 | 166 | public void setProperty05(String property05) { 167 | this.property05 = property05; 168 | } 169 | 170 | public String getProperty06() { 171 | return property06; 172 | } 173 | 174 | public void setProperty06(String property06) { 175 | this.property06 = property06; 176 | } 177 | 178 | public String getProperty07() { 179 | return property07; 180 | } 181 | 182 | public void setProperty07(String property07) { 183 | this.property07 = property07; 184 | } 185 | 186 | public String getProperty08() { 187 | return property08; 188 | } 189 | 190 | public void setProperty08(String property08) { 191 | this.property08 = property08; 192 | } 193 | 194 | public String getProperty09() { 195 | return property09; 196 | } 197 | 198 | public void setProperty09(String property09) { 199 | this.property09 = property09; 200 | } 201 | 202 | public String getProperty10() { 203 | return property10; 204 | } 205 | 206 | public void setProperty10(String property10) { 207 | this.property10 = property10; 208 | } 209 | 210 | public String getProperty11() { 211 | return property11; 212 | } 213 | 214 | public void setProperty11(String property11) { 215 | this.property11 = property11; 216 | } 217 | 218 | public String getProperty12() { 219 | return property12; 220 | } 221 | 222 | public void setProperty12(String property12) { 223 | this.property12 = property12; 224 | } 225 | 226 | public String getProperty13() { 227 | return property13; 228 | } 229 | 230 | public void setProperty13(String property13) { 231 | this.property13 = property13; 232 | } 233 | 234 | public String getProperty14() { 235 | return property14; 236 | } 237 | 238 | public void setProperty14(String property14) { 239 | this.property14 = property14; 240 | } 241 | 242 | public String getProperty15() { 243 | return property15; 244 | } 245 | 246 | public void setProperty15(String property15) { 247 | this.property15 = property15; 248 | } 249 | 250 | public String getProperty16() { 251 | return property16; 252 | } 253 | 254 | public void setProperty16(String property16) { 255 | this.property16 = property16; 256 | } 257 | 258 | public String getProperty17() { 259 | return property17; 260 | } 261 | 262 | public void setProperty17(String property17) { 263 | this.property17 = property17; 264 | } 265 | 266 | public String getProperty18() { 267 | return property18; 268 | } 269 | 270 | public void setProperty18(String property18) { 271 | this.property18 = property18; 272 | } 273 | 274 | public String getProperty19() { 275 | return property19; 276 | } 277 | 278 | public void setProperty19(String property19) { 279 | this.property19 = property19; 280 | } 281 | 282 | public String getProperty20() { 283 | return property20; 284 | } 285 | 286 | public void setProperty20(String property20) { 287 | this.property20 = property20; 288 | } 289 | 290 | public String getProperty21() { 291 | return property21; 292 | } 293 | 294 | public void setProperty21(String property21) { 295 | this.property21 = property21; 296 | } 297 | 298 | public String getProperty22() { 299 | return property22; 300 | } 301 | 302 | public void setProperty22(String property22) { 303 | this.property22 = property22; 304 | } 305 | 306 | public String getProperty23() { 307 | return property23; 308 | } 309 | 310 | public void setProperty23(String property23) { 311 | this.property23 = property23; 312 | } 313 | 314 | public String getProperty24() { 315 | return property24; 316 | } 317 | 318 | public void setProperty24(String property24) { 319 | this.property24 = property24; 320 | } 321 | 322 | public String getProperty25() { 323 | return property25; 324 | } 325 | 326 | public void setProperty25(String property25) { 327 | this.property25 = property25; 328 | } 329 | 330 | public String getProperty26() { 331 | return property26; 332 | } 333 | 334 | public void setProperty26(String property26) { 335 | this.property26 = property26; 336 | } 337 | 338 | public String getProperty27() { 339 | return property27; 340 | } 341 | 342 | public void setProperty27(String property27) { 343 | this.property27 = property27; 344 | } 345 | 346 | public String getProperty28() { 347 | return property28; 348 | } 349 | 350 | public void setProperty28(String property28) { 351 | this.property28 = property28; 352 | } 353 | 354 | public String getProperty29() { 355 | return property29; 356 | } 357 | 358 | public void setProperty29(String property29) { 359 | this.property29 = property29; 360 | } 361 | 362 | public String getProperty30() { 363 | return property30; 364 | } 365 | 366 | public void setProperty30(String property30) { 367 | this.property30 = property30; 368 | } 369 | 370 | public String getProperty31() { 371 | return property31; 372 | } 373 | 374 | public void setProperty31(String property31) { 375 | this.property31 = property31; 376 | } 377 | 378 | public String getProperty32() { 379 | return property32; 380 | } 381 | 382 | public void setProperty32(String property32) { 383 | this.property32 = property32; 384 | } 385 | 386 | public String getProperty33() { 387 | return property33; 388 | } 389 | 390 | public void setProperty33(String property33) { 391 | this.property33 = property33; 392 | } 393 | 394 | public String getProperty34() { 395 | return property34; 396 | } 397 | 398 | public void setProperty34(String property34) { 399 | this.property34 = property34; 400 | } 401 | 402 | public String getProperty35() { 403 | return property35; 404 | } 405 | 406 | public void setProperty35(String property35) { 407 | this.property35 = property35; 408 | } 409 | 410 | public String getProperty36() { 411 | return property36; 412 | } 413 | 414 | public void setProperty36(String property36) { 415 | this.property36 = property36; 416 | } 417 | 418 | public String getProperty37() { 419 | return property37; 420 | } 421 | 422 | public void setProperty37(String property37) { 423 | this.property37 = property37; 424 | } 425 | 426 | public String getProperty38() { 427 | return property38; 428 | } 429 | 430 | public void setProperty38(String property38) { 431 | this.property38 = property38; 432 | } 433 | 434 | public String getProperty39() { 435 | return property39; 436 | } 437 | 438 | public void setProperty39(String property39) { 439 | this.property39 = property39; 440 | } 441 | 442 | public String getProperty40() { 443 | return property40; 444 | } 445 | 446 | public void setProperty40(String property40) { 447 | this.property40 = property40; 448 | } 449 | 450 | public String getProperty41() { 451 | return property41; 452 | } 453 | 454 | public void setProperty41(String property41) { 455 | this.property41 = property41; 456 | } 457 | 458 | public String getProperty42() { 459 | return property42; 460 | } 461 | 462 | public void setProperty42(String property42) { 463 | this.property42 = property42; 464 | } 465 | 466 | public String getProperty43() { 467 | return property43; 468 | } 469 | 470 | public void setProperty43(String property43) { 471 | this.property43 = property43; 472 | } 473 | 474 | public String getProperty44() { 475 | return property44; 476 | } 477 | 478 | public void setProperty44(String property44) { 479 | this.property44 = property44; 480 | } 481 | 482 | public String getProperty45() { 483 | return property45; 484 | } 485 | 486 | public void setProperty45(String property45) { 487 | this.property45 = property45; 488 | } 489 | 490 | public String getProperty46() { 491 | return property46; 492 | } 493 | 494 | public void setProperty46(String property46) { 495 | this.property46 = property46; 496 | } 497 | 498 | public String getProperty47() { 499 | return property47; 500 | } 501 | 502 | public void setProperty47(String property47) { 503 | this.property47 = property47; 504 | } 505 | 506 | public String getProperty48() { 507 | return property48; 508 | } 509 | 510 | public void setProperty48(String property48) { 511 | this.property48 = property48; 512 | } 513 | 514 | public String getProperty49() { 515 | return property49; 516 | } 517 | 518 | public void setProperty49(String property49) { 519 | this.property49 = property49; 520 | } 521 | 522 | public String getProperty50() { 523 | return property50; 524 | } 525 | 526 | public void setProperty50(String property50) { 527 | this.property50 = property50; 528 | } 529 | 530 | public String getProperty51() { 531 | return property51; 532 | } 533 | 534 | public void setProperty51(String property51) { 535 | this.property51 = property51; 536 | } 537 | 538 | public String getProperty52() { 539 | return property52; 540 | } 541 | 542 | public void setProperty52(String property52) { 543 | this.property52 = property52; 544 | } 545 | 546 | public String getProperty53() { 547 | return property53; 548 | } 549 | 550 | public void setProperty53(String property53) { 551 | this.property53 = property53; 552 | } 553 | 554 | public String getProperty54() { 555 | return property54; 556 | } 557 | 558 | public void setProperty54(String property54) { 559 | this.property54 = property54; 560 | } 561 | 562 | public String getProperty55() { 563 | return property55; 564 | } 565 | 566 | public void setProperty55(String property55) { 567 | this.property55 = property55; 568 | } 569 | 570 | public String getProperty56() { 571 | return property56; 572 | } 573 | 574 | public void setProperty56(String property56) { 575 | this.property56 = property56; 576 | } 577 | 578 | public String getProperty57() { 579 | return property57; 580 | } 581 | 582 | public void setProperty57(String property57) { 583 | this.property57 = property57; 584 | } 585 | 586 | public String getProperty58() { 587 | return property58; 588 | } 589 | 590 | public void setProperty58(String property58) { 591 | this.property58 = property58; 592 | } 593 | 594 | public String getProperty59() { 595 | return property59; 596 | } 597 | 598 | public void setProperty59(String property59) { 599 | this.property59 = property59; 600 | } 601 | 602 | public String getProperty60() { 603 | return property60; 604 | } 605 | 606 | public void setProperty60(String property60) { 607 | this.property60 = property60; 608 | } 609 | 610 | public String getProperty61() { 611 | return property61; 612 | } 613 | 614 | public void setProperty61(String property61) { 615 | this.property61 = property61; 616 | } 617 | 618 | public String getProperty62() { 619 | return property62; 620 | } 621 | 622 | public void setProperty62(String property62) { 623 | this.property62 = property62; 624 | } 625 | 626 | public String getProperty63() { 627 | return property63; 628 | } 629 | 630 | public void setProperty63(String property63) { 631 | this.property63 = property63; 632 | } 633 | 634 | public String getProperty64() { 635 | return property64; 636 | } 637 | 638 | public void setProperty64(String property64) { 639 | this.property64 = property64; 640 | } 641 | 642 | public String getProperty65() { 643 | return property65; 644 | } 645 | 646 | public void setProperty65(String property65) { 647 | this.property65 = property65; 648 | } 649 | 650 | public String getProperty66() { 651 | return property66; 652 | } 653 | 654 | public void setProperty66(String property66) { 655 | this.property66 = property66; 656 | } 657 | 658 | public String getProperty67() { 659 | return property67; 660 | } 661 | 662 | public void setProperty67(String property67) { 663 | this.property67 = property67; 664 | } 665 | 666 | public String getProperty68() { 667 | return property68; 668 | } 669 | 670 | public void setProperty68(String property68) { 671 | this.property68 = property68; 672 | } 673 | 674 | public String getProperty69() { 675 | return property69; 676 | } 677 | 678 | public void setProperty69(String property69) { 679 | this.property69 = property69; 680 | } 681 | 682 | public String getProperty70() { 683 | return property70; 684 | } 685 | 686 | public void setProperty70(String property70) { 687 | this.property70 = property70; 688 | } 689 | 690 | public String getProperty71() { 691 | return property71; 692 | } 693 | 694 | public void setProperty71(String property71) { 695 | this.property71 = property71; 696 | } 697 | 698 | public String getProperty72() { 699 | return property72; 700 | } 701 | 702 | public void setProperty72(String property72) { 703 | this.property72 = property72; 704 | } 705 | 706 | public String getProperty73() { 707 | return property73; 708 | } 709 | 710 | public void setProperty73(String property73) { 711 | this.property73 = property73; 712 | } 713 | 714 | public String getProperty74() { 715 | return property74; 716 | } 717 | 718 | public void setProperty74(String property74) { 719 | this.property74 = property74; 720 | } 721 | 722 | public String getProperty75() { 723 | return property75; 724 | } 725 | 726 | public void setProperty75(String property75) { 727 | this.property75 = property75; 728 | } 729 | 730 | public String getProperty76() { 731 | return property76; 732 | } 733 | 734 | public void setProperty76(String property76) { 735 | this.property76 = property76; 736 | } 737 | 738 | public String getProperty77() { 739 | return property77; 740 | } 741 | 742 | public void setProperty77(String property77) { 743 | this.property77 = property77; 744 | } 745 | 746 | public String getProperty78() { 747 | return property78; 748 | } 749 | 750 | public void setProperty78(String property78) { 751 | this.property78 = property78; 752 | } 753 | 754 | public String getProperty79() { 755 | return property79; 756 | } 757 | 758 | public void setProperty79(String property79) { 759 | this.property79 = property79; 760 | } 761 | 762 | public String getProperty80() { 763 | return property80; 764 | } 765 | 766 | public void setProperty80(String property80) { 767 | this.property80 = property80; 768 | } 769 | 770 | public String getProperty81() { 771 | return property81; 772 | } 773 | 774 | public void setProperty81(String property81) { 775 | this.property81 = property81; 776 | } 777 | 778 | public String getProperty82() { 779 | return property82; 780 | } 781 | 782 | public void setProperty82(String property82) { 783 | this.property82 = property82; 784 | } 785 | 786 | public String getProperty83() { 787 | return property83; 788 | } 789 | 790 | public void setProperty83(String property83) { 791 | this.property83 = property83; 792 | } 793 | 794 | public String getProperty84() { 795 | return property84; 796 | } 797 | 798 | public void setProperty84(String property84) { 799 | this.property84 = property84; 800 | } 801 | 802 | public String getProperty85() { 803 | return property85; 804 | } 805 | 806 | public void setProperty85(String property85) { 807 | this.property85 = property85; 808 | } 809 | 810 | public String getProperty86() { 811 | return property86; 812 | } 813 | 814 | public void setProperty86(String property86) { 815 | this.property86 = property86; 816 | } 817 | 818 | public String getProperty87() { 819 | return property87; 820 | } 821 | 822 | public void setProperty87(String property87) { 823 | this.property87 = property87; 824 | } 825 | 826 | public String getProperty88() { 827 | return property88; 828 | } 829 | 830 | public void setProperty88(String property88) { 831 | this.property88 = property88; 832 | } 833 | 834 | public String getProperty89() { 835 | return property89; 836 | } 837 | 838 | public void setProperty89(String property89) { 839 | this.property89 = property89; 840 | } 841 | 842 | public String getProperty90() { 843 | return property90; 844 | } 845 | 846 | public void setProperty90(String property90) { 847 | this.property90 = property90; 848 | } 849 | 850 | public String getProperty91() { 851 | return property91; 852 | } 853 | 854 | public void setProperty91(String property91) { 855 | this.property91 = property91; 856 | } 857 | 858 | public String getProperty92() { 859 | return property92; 860 | } 861 | 862 | public void setProperty92(String property92) { 863 | this.property92 = property92; 864 | } 865 | 866 | public String getProperty93() { 867 | return property93; 868 | } 869 | 870 | public void setProperty93(String property93) { 871 | this.property93 = property93; 872 | } 873 | 874 | public String getProperty94() { 875 | return property94; 876 | } 877 | 878 | public void setProperty94(String property94) { 879 | this.property94 = property94; 880 | } 881 | 882 | public String getProperty95() { 883 | return property95; 884 | } 885 | 886 | public void setProperty95(String property95) { 887 | this.property95 = property95; 888 | } 889 | 890 | public String getProperty96() { 891 | return property96; 892 | } 893 | 894 | public void setProperty96(String property96) { 895 | this.property96 = property96; 896 | } 897 | 898 | public String getProperty97() { 899 | return property97; 900 | } 901 | 902 | public void setProperty97(String property97) { 903 | this.property97 = property97; 904 | } 905 | 906 | public String getProperty98() { 907 | return property98; 908 | } 909 | 910 | public void setProperty98(String property98) { 911 | this.property98 = property98; 912 | } 913 | 914 | public String getProperty99() { 915 | return property99; 916 | } 917 | 918 | public void setProperty99(String property99) { 919 | this.property99 = property99; 920 | } 921 | 922 | public String getProperty100() { 923 | return property100; 924 | } 925 | 926 | public void setProperty100(String property100) { 927 | this.property100 = property100; 928 | } 929 | 930 | public List getEmployees() { 931 | return employees; 932 | } 933 | 934 | public void setEmployees(List employeeEntities) { 935 | this.employees = employeeEntities; 936 | } 937 | 938 | @Override 939 | public boolean equals(Object o) { 940 | if (this == o) { return true; } 941 | if (o == null || getClass() != o.getClass()) { return false; } 942 | 943 | DepartmentEntity that = (DepartmentEntity) o; 944 | 945 | return id.equals(that.id); 946 | } 947 | 948 | @Override 949 | public int hashCode() { 950 | return id.hashCode(); 951 | } 952 | } 953 | -------------------------------------------------------------------------------- /src/main/java/com/cortez/samples/jpaperformance/data/EmployeeEntity.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.data; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Id; 5 | import javax.persistence.ManyToOne; 6 | 7 | /** 8 | * @author Roberto Cortez 9 | */ 10 | @Entity 11 | public class EmployeeEntity { 12 | @Id 13 | private Long id; 14 | private String property01; 15 | private String property02; 16 | private String property03; 17 | private String property04; 18 | private String property05; 19 | private String property06; 20 | private String property07; 21 | private String property08; 22 | private String property09; 23 | private String property10; 24 | private String property11; 25 | private String property12; 26 | private String property13; 27 | private String property14; 28 | private String property15; 29 | private String property16; 30 | private String property17; 31 | private String property18; 32 | private String property19; 33 | private String property20; 34 | private String property21; 35 | private String property22; 36 | private String property23; 37 | private String property24; 38 | private String property25; 39 | private String property26; 40 | private String property27; 41 | private String property28; 42 | private String property29; 43 | private String property30; 44 | private String property31; 45 | private String property32; 46 | private String property33; 47 | private String property34; 48 | private String property35; 49 | private String property36; 50 | private String property37; 51 | private String property38; 52 | private String property39; 53 | private String property40; 54 | private String property41; 55 | private String property42; 56 | private String property43; 57 | private String property44; 58 | private String property45; 59 | private String property46; 60 | private String property47; 61 | private String property48; 62 | private String property49; 63 | private String property50; 64 | private String property51; 65 | private String property52; 66 | private String property53; 67 | private String property54; 68 | private String property55; 69 | private String property56; 70 | private String property57; 71 | private String property58; 72 | private String property59; 73 | private String property60; 74 | private String property61; 75 | private String property62; 76 | private String property63; 77 | private String property64; 78 | private String property65; 79 | private String property66; 80 | private String property67; 81 | private String property68; 82 | private String property69; 83 | private String property70; 84 | private String property71; 85 | private String property72; 86 | private String property73; 87 | private String property74; 88 | private String property75; 89 | private String property76; 90 | private String property77; 91 | private String property78; 92 | private String property79; 93 | private String property80; 94 | private String property81; 95 | private String property82; 96 | private String property83; 97 | private String property84; 98 | private String property85; 99 | private String property86; 100 | private String property87; 101 | private String property88; 102 | private String property89; 103 | private String property90; 104 | private String property91; 105 | private String property92; 106 | private String property93; 107 | private String property94; 108 | private String property95; 109 | private String property96; 110 | private String property97; 111 | private String property98; 112 | private String property99; 113 | private String property100; 114 | 115 | @ManyToOne 116 | private DepartmentEntity departmentEntity; 117 | 118 | public Long getId() { 119 | return id; 120 | } 121 | 122 | public void setId(Long id) { 123 | this.id = id; 124 | } 125 | 126 | public String getProperty01() { 127 | return property01; 128 | } 129 | 130 | public void setProperty01(String property01) { 131 | this.property01 = property01; 132 | } 133 | 134 | public String getProperty02() { 135 | return property02; 136 | } 137 | 138 | public void setProperty02(String property02) { 139 | this.property02 = property02; 140 | } 141 | 142 | public String getProperty03() { 143 | return property03; 144 | } 145 | 146 | public void setProperty03(String property03) { 147 | this.property03 = property03; 148 | } 149 | 150 | public String getProperty04() { 151 | return property04; 152 | } 153 | 154 | public void setProperty04(String property04) { 155 | this.property04 = property04; 156 | } 157 | 158 | public String getProperty05() { 159 | return property05; 160 | } 161 | 162 | public void setProperty05(String property05) { 163 | this.property05 = property05; 164 | } 165 | 166 | public String getProperty06() { 167 | return property06; 168 | } 169 | 170 | public void setProperty06(String property06) { 171 | this.property06 = property06; 172 | } 173 | 174 | public String getProperty07() { 175 | return property07; 176 | } 177 | 178 | public void setProperty07(String property07) { 179 | this.property07 = property07; 180 | } 181 | 182 | public String getProperty08() { 183 | return property08; 184 | } 185 | 186 | public void setProperty08(String property08) { 187 | this.property08 = property08; 188 | } 189 | 190 | public String getProperty09() { 191 | return property09; 192 | } 193 | 194 | public void setProperty09(String property09) { 195 | this.property09 = property09; 196 | } 197 | 198 | public String getProperty10() { 199 | return property10; 200 | } 201 | 202 | public void setProperty10(String property10) { 203 | this.property10 = property10; 204 | } 205 | 206 | public String getProperty11() { 207 | return property11; 208 | } 209 | 210 | public void setProperty11(String property11) { 211 | this.property11 = property11; 212 | } 213 | 214 | public String getProperty12() { 215 | return property12; 216 | } 217 | 218 | public void setProperty12(String property12) { 219 | this.property12 = property12; 220 | } 221 | 222 | public String getProperty13() { 223 | return property13; 224 | } 225 | 226 | public void setProperty13(String property13) { 227 | this.property13 = property13; 228 | } 229 | 230 | public String getProperty14() { 231 | return property14; 232 | } 233 | 234 | public void setProperty14(String property14) { 235 | this.property14 = property14; 236 | } 237 | 238 | public String getProperty15() { 239 | return property15; 240 | } 241 | 242 | public void setProperty15(String property15) { 243 | this.property15 = property15; 244 | } 245 | 246 | public String getProperty16() { 247 | return property16; 248 | } 249 | 250 | public void setProperty16(String property16) { 251 | this.property16 = property16; 252 | } 253 | 254 | public String getProperty17() { 255 | return property17; 256 | } 257 | 258 | public void setProperty17(String property17) { 259 | this.property17 = property17; 260 | } 261 | 262 | public String getProperty18() { 263 | return property18; 264 | } 265 | 266 | public void setProperty18(String property18) { 267 | this.property18 = property18; 268 | } 269 | 270 | public String getProperty19() { 271 | return property19; 272 | } 273 | 274 | public void setProperty19(String property19) { 275 | this.property19 = property19; 276 | } 277 | 278 | public String getProperty20() { 279 | return property20; 280 | } 281 | 282 | public void setProperty20(String property20) { 283 | this.property20 = property20; 284 | } 285 | 286 | public String getProperty21() { 287 | return property21; 288 | } 289 | 290 | public void setProperty21(String property21) { 291 | this.property21 = property21; 292 | } 293 | 294 | public String getProperty22() { 295 | return property22; 296 | } 297 | 298 | public void setProperty22(String property22) { 299 | this.property22 = property22; 300 | } 301 | 302 | public String getProperty23() { 303 | return property23; 304 | } 305 | 306 | public void setProperty23(String property23) { 307 | this.property23 = property23; 308 | } 309 | 310 | public String getProperty24() { 311 | return property24; 312 | } 313 | 314 | public void setProperty24(String property24) { 315 | this.property24 = property24; 316 | } 317 | 318 | public String getProperty25() { 319 | return property25; 320 | } 321 | 322 | public void setProperty25(String property25) { 323 | this.property25 = property25; 324 | } 325 | 326 | public String getProperty26() { 327 | return property26; 328 | } 329 | 330 | public void setProperty26(String property26) { 331 | this.property26 = property26; 332 | } 333 | 334 | public String getProperty27() { 335 | return property27; 336 | } 337 | 338 | public void setProperty27(String property27) { 339 | this.property27 = property27; 340 | } 341 | 342 | public String getProperty28() { 343 | return property28; 344 | } 345 | 346 | public void setProperty28(String property28) { 347 | this.property28 = property28; 348 | } 349 | 350 | public String getProperty29() { 351 | return property29; 352 | } 353 | 354 | public void setProperty29(String property29) { 355 | this.property29 = property29; 356 | } 357 | 358 | public String getProperty30() { 359 | return property30; 360 | } 361 | 362 | public void setProperty30(String property30) { 363 | this.property30 = property30; 364 | } 365 | 366 | public String getProperty31() { 367 | return property31; 368 | } 369 | 370 | public void setProperty31(String property31) { 371 | this.property31 = property31; 372 | } 373 | 374 | public String getProperty32() { 375 | return property32; 376 | } 377 | 378 | public void setProperty32(String property32) { 379 | this.property32 = property32; 380 | } 381 | 382 | public String getProperty33() { 383 | return property33; 384 | } 385 | 386 | public void setProperty33(String property33) { 387 | this.property33 = property33; 388 | } 389 | 390 | public String getProperty34() { 391 | return property34; 392 | } 393 | 394 | public void setProperty34(String property34) { 395 | this.property34 = property34; 396 | } 397 | 398 | public String getProperty35() { 399 | return property35; 400 | } 401 | 402 | public void setProperty35(String property35) { 403 | this.property35 = property35; 404 | } 405 | 406 | public String getProperty36() { 407 | return property36; 408 | } 409 | 410 | public void setProperty36(String property36) { 411 | this.property36 = property36; 412 | } 413 | 414 | public String getProperty37() { 415 | return property37; 416 | } 417 | 418 | public void setProperty37(String property37) { 419 | this.property37 = property37; 420 | } 421 | 422 | public String getProperty38() { 423 | return property38; 424 | } 425 | 426 | public void setProperty38(String property38) { 427 | this.property38 = property38; 428 | } 429 | 430 | public String getProperty39() { 431 | return property39; 432 | } 433 | 434 | public void setProperty39(String property39) { 435 | this.property39 = property39; 436 | } 437 | 438 | public String getProperty40() { 439 | return property40; 440 | } 441 | 442 | public void setProperty40(String property40) { 443 | this.property40 = property40; 444 | } 445 | 446 | public String getProperty41() { 447 | return property41; 448 | } 449 | 450 | public void setProperty41(String property41) { 451 | this.property41 = property41; 452 | } 453 | 454 | public String getProperty42() { 455 | return property42; 456 | } 457 | 458 | public void setProperty42(String property42) { 459 | this.property42 = property42; 460 | } 461 | 462 | public String getProperty43() { 463 | return property43; 464 | } 465 | 466 | public void setProperty43(String property43) { 467 | this.property43 = property43; 468 | } 469 | 470 | public String getProperty44() { 471 | return property44; 472 | } 473 | 474 | public void setProperty44(String property44) { 475 | this.property44 = property44; 476 | } 477 | 478 | public String getProperty45() { 479 | return property45; 480 | } 481 | 482 | public void setProperty45(String property45) { 483 | this.property45 = property45; 484 | } 485 | 486 | public String getProperty46() { 487 | return property46; 488 | } 489 | 490 | public void setProperty46(String property46) { 491 | this.property46 = property46; 492 | } 493 | 494 | public String getProperty47() { 495 | return property47; 496 | } 497 | 498 | public void setProperty47(String property47) { 499 | this.property47 = property47; 500 | } 501 | 502 | public String getProperty48() { 503 | return property48; 504 | } 505 | 506 | public void setProperty48(String property48) { 507 | this.property48 = property48; 508 | } 509 | 510 | public String getProperty49() { 511 | return property49; 512 | } 513 | 514 | public void setProperty49(String property49) { 515 | this.property49 = property49; 516 | } 517 | 518 | public String getProperty50() { 519 | return property50; 520 | } 521 | 522 | public void setProperty50(String property50) { 523 | this.property50 = property50; 524 | } 525 | 526 | public String getProperty51() { 527 | return property51; 528 | } 529 | 530 | public void setProperty51(String property51) { 531 | this.property51 = property51; 532 | } 533 | 534 | public String getProperty52() { 535 | return property52; 536 | } 537 | 538 | public void setProperty52(String property52) { 539 | this.property52 = property52; 540 | } 541 | 542 | public String getProperty53() { 543 | return property53; 544 | } 545 | 546 | public void setProperty53(String property53) { 547 | this.property53 = property53; 548 | } 549 | 550 | public String getProperty54() { 551 | return property54; 552 | } 553 | 554 | public void setProperty54(String property54) { 555 | this.property54 = property54; 556 | } 557 | 558 | public String getProperty55() { 559 | return property55; 560 | } 561 | 562 | public void setProperty55(String property55) { 563 | this.property55 = property55; 564 | } 565 | 566 | public String getProperty56() { 567 | return property56; 568 | } 569 | 570 | public void setProperty56(String property56) { 571 | this.property56 = property56; 572 | } 573 | 574 | public String getProperty57() { 575 | return property57; 576 | } 577 | 578 | public void setProperty57(String property57) { 579 | this.property57 = property57; 580 | } 581 | 582 | public String getProperty58() { 583 | return property58; 584 | } 585 | 586 | public void setProperty58(String property58) { 587 | this.property58 = property58; 588 | } 589 | 590 | public String getProperty59() { 591 | return property59; 592 | } 593 | 594 | public void setProperty59(String property59) { 595 | this.property59 = property59; 596 | } 597 | 598 | public String getProperty60() { 599 | return property60; 600 | } 601 | 602 | public void setProperty60(String property60) { 603 | this.property60 = property60; 604 | } 605 | 606 | public String getProperty61() { 607 | return property61; 608 | } 609 | 610 | public void setProperty61(String property61) { 611 | this.property61 = property61; 612 | } 613 | 614 | public String getProperty62() { 615 | return property62; 616 | } 617 | 618 | public void setProperty62(String property62) { 619 | this.property62 = property62; 620 | } 621 | 622 | public String getProperty63() { 623 | return property63; 624 | } 625 | 626 | public void setProperty63(String property63) { 627 | this.property63 = property63; 628 | } 629 | 630 | public String getProperty64() { 631 | return property64; 632 | } 633 | 634 | public void setProperty64(String property64) { 635 | this.property64 = property64; 636 | } 637 | 638 | public String getProperty65() { 639 | return property65; 640 | } 641 | 642 | public void setProperty65(String property65) { 643 | this.property65 = property65; 644 | } 645 | 646 | public String getProperty66() { 647 | return property66; 648 | } 649 | 650 | public void setProperty66(String property66) { 651 | this.property66 = property66; 652 | } 653 | 654 | public String getProperty67() { 655 | return property67; 656 | } 657 | 658 | public void setProperty67(String property67) { 659 | this.property67 = property67; 660 | } 661 | 662 | public String getProperty68() { 663 | return property68; 664 | } 665 | 666 | public void setProperty68(String property68) { 667 | this.property68 = property68; 668 | } 669 | 670 | public String getProperty69() { 671 | return property69; 672 | } 673 | 674 | public void setProperty69(String property69) { 675 | this.property69 = property69; 676 | } 677 | 678 | public String getProperty70() { 679 | return property70; 680 | } 681 | 682 | public void setProperty70(String property70) { 683 | this.property70 = property70; 684 | } 685 | 686 | public String getProperty71() { 687 | return property71; 688 | } 689 | 690 | public void setProperty71(String property71) { 691 | this.property71 = property71; 692 | } 693 | 694 | public String getProperty72() { 695 | return property72; 696 | } 697 | 698 | public void setProperty72(String property72) { 699 | this.property72 = property72; 700 | } 701 | 702 | public String getProperty73() { 703 | return property73; 704 | } 705 | 706 | public void setProperty73(String property73) { 707 | this.property73 = property73; 708 | } 709 | 710 | public String getProperty74() { 711 | return property74; 712 | } 713 | 714 | public void setProperty74(String property74) { 715 | this.property74 = property74; 716 | } 717 | 718 | public String getProperty75() { 719 | return property75; 720 | } 721 | 722 | public void setProperty75(String property75) { 723 | this.property75 = property75; 724 | } 725 | 726 | public String getProperty76() { 727 | return property76; 728 | } 729 | 730 | public void setProperty76(String property76) { 731 | this.property76 = property76; 732 | } 733 | 734 | public String getProperty77() { 735 | return property77; 736 | } 737 | 738 | public void setProperty77(String property77) { 739 | this.property77 = property77; 740 | } 741 | 742 | public String getProperty78() { 743 | return property78; 744 | } 745 | 746 | public void setProperty78(String property78) { 747 | this.property78 = property78; 748 | } 749 | 750 | public String getProperty79() { 751 | return property79; 752 | } 753 | 754 | public void setProperty79(String property79) { 755 | this.property79 = property79; 756 | } 757 | 758 | public String getProperty80() { 759 | return property80; 760 | } 761 | 762 | public void setProperty80(String property80) { 763 | this.property80 = property80; 764 | } 765 | 766 | public String getProperty81() { 767 | return property81; 768 | } 769 | 770 | public void setProperty81(String property81) { 771 | this.property81 = property81; 772 | } 773 | 774 | public String getProperty82() { 775 | return property82; 776 | } 777 | 778 | public void setProperty82(String property82) { 779 | this.property82 = property82; 780 | } 781 | 782 | public String getProperty83() { 783 | return property83; 784 | } 785 | 786 | public void setProperty83(String property83) { 787 | this.property83 = property83; 788 | } 789 | 790 | public String getProperty84() { 791 | return property84; 792 | } 793 | 794 | public void setProperty84(String property84) { 795 | this.property84 = property84; 796 | } 797 | 798 | public String getProperty85() { 799 | return property85; 800 | } 801 | 802 | public void setProperty85(String property85) { 803 | this.property85 = property85; 804 | } 805 | 806 | public String getProperty86() { 807 | return property86; 808 | } 809 | 810 | public void setProperty86(String property86) { 811 | this.property86 = property86; 812 | } 813 | 814 | public String getProperty87() { 815 | return property87; 816 | } 817 | 818 | public void setProperty87(String property87) { 819 | this.property87 = property87; 820 | } 821 | 822 | public String getProperty88() { 823 | return property88; 824 | } 825 | 826 | public void setProperty88(String property88) { 827 | this.property88 = property88; 828 | } 829 | 830 | public String getProperty89() { 831 | return property89; 832 | } 833 | 834 | public void setProperty89(String property89) { 835 | this.property89 = property89; 836 | } 837 | 838 | public String getProperty90() { 839 | return property90; 840 | } 841 | 842 | public void setProperty90(String property90) { 843 | this.property90 = property90; 844 | } 845 | 846 | public String getProperty91() { 847 | return property91; 848 | } 849 | 850 | public void setProperty91(String property91) { 851 | this.property91 = property91; 852 | } 853 | 854 | public String getProperty92() { 855 | return property92; 856 | } 857 | 858 | public void setProperty92(String property92) { 859 | this.property92 = property92; 860 | } 861 | 862 | public String getProperty93() { 863 | return property93; 864 | } 865 | 866 | public void setProperty93(String property93) { 867 | this.property93 = property93; 868 | } 869 | 870 | public String getProperty94() { 871 | return property94; 872 | } 873 | 874 | public void setProperty94(String property94) { 875 | this.property94 = property94; 876 | } 877 | 878 | public String getProperty95() { 879 | return property95; 880 | } 881 | 882 | public void setProperty95(String property95) { 883 | this.property95 = property95; 884 | } 885 | 886 | public String getProperty96() { 887 | return property96; 888 | } 889 | 890 | public void setProperty96(String property96) { 891 | this.property96 = property96; 892 | } 893 | 894 | public String getProperty97() { 895 | return property97; 896 | } 897 | 898 | public void setProperty97(String property97) { 899 | this.property97 = property97; 900 | } 901 | 902 | public String getProperty98() { 903 | return property98; 904 | } 905 | 906 | public void setProperty98(String property98) { 907 | this.property98 = property98; 908 | } 909 | 910 | public String getProperty99() { 911 | return property99; 912 | } 913 | 914 | public void setProperty99(String property99) { 915 | this.property99 = property99; 916 | } 917 | 918 | public String getProperty100() { 919 | return property100; 920 | } 921 | 922 | public void setProperty100(String property100) { 923 | this.property100 = property100; 924 | } 925 | 926 | public DepartmentEntity getDepartmentEntity() { 927 | return departmentEntity; 928 | } 929 | 930 | public void setDepartmentEntity(DepartmentEntity departmentEntity) { 931 | this.departmentEntity = departmentEntity; 932 | } 933 | 934 | @Override 935 | public boolean equals(Object o) { 936 | if (this == o) { return true; } 937 | if (o == null || getClass() != o.getClass()) { return false; } 938 | 939 | EmployeeEntity that = (EmployeeEntity) o; 940 | 941 | return id.equals(that.id); 942 | } 943 | 944 | @Override 945 | public int hashCode() { 946 | return id.hashCode(); 947 | } 948 | } 949 | -------------------------------------------------------------------------------- /src/main/java/com/cortez/samples/jpaperformance/data/LazyEntity.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.data; 2 | 3 | import javax.persistence.Basic; 4 | import javax.persistence.Entity; 5 | import javax.persistence.FetchType; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * @author Roberto Cortez 10 | */ 11 | @Entity 12 | public class LazyEntity { 13 | @Id 14 | private Long id; 15 | @Basic(fetch = FetchType.LAZY) 16 | private String property01; 17 | @Basic(fetch = FetchType.LAZY) 18 | private String property02; 19 | @Basic(fetch = FetchType.LAZY) 20 | private String property03; 21 | @Basic(fetch = FetchType.LAZY) 22 | private String property04; 23 | @Basic(fetch = FetchType.LAZY) 24 | private String property05; 25 | @Basic(fetch = FetchType.LAZY) 26 | private String property06; 27 | @Basic(fetch = FetchType.LAZY) 28 | private String property07; 29 | @Basic(fetch = FetchType.LAZY) 30 | private String property08; 31 | @Basic(fetch = FetchType.LAZY) 32 | private String property09; 33 | @Basic(fetch = FetchType.LAZY) 34 | private String property10; 35 | 36 | public Long getId() { 37 | return id; 38 | } 39 | 40 | public void setId(Long id) { 41 | this.id = id; 42 | } 43 | 44 | public String getProperty01() { 45 | return property01; 46 | } 47 | 48 | public void setProperty01(String property01) { 49 | this.property01 = property01; 50 | } 51 | 52 | public String getProperty02() { 53 | return property02; 54 | } 55 | 56 | public void setProperty02(String property02) { 57 | this.property02 = property02; 58 | } 59 | 60 | public String getProperty03() { 61 | return property03; 62 | } 63 | 64 | public void setProperty03(String property03) { 65 | this.property03 = property03; 66 | } 67 | 68 | public String getProperty04() { 69 | return property04; 70 | } 71 | 72 | public void setProperty04(String property04) { 73 | this.property04 = property04; 74 | } 75 | 76 | public String getProperty05() { 77 | return property05; 78 | } 79 | 80 | public void setProperty05(String property05) { 81 | this.property05 = property05; 82 | } 83 | 84 | public String getProperty06() { 85 | return property06; 86 | } 87 | 88 | public void setProperty06(String property06) { 89 | this.property06 = property06; 90 | } 91 | 92 | public String getProperty07() { 93 | return property07; 94 | } 95 | 96 | public void setProperty07(String property07) { 97 | this.property07 = property07; 98 | } 99 | 100 | public String getProperty08() { 101 | return property08; 102 | } 103 | 104 | public void setProperty08(String property08) { 105 | this.property08 = property08; 106 | } 107 | 108 | public String getProperty09() { 109 | return property09; 110 | } 111 | 112 | public void setProperty09(String property09) { 113 | this.property09 = property09; 114 | } 115 | 116 | public String getProperty10() { 117 | return property10; 118 | } 119 | 120 | public void setProperty10(String property10) { 121 | this.property10 = property10; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/java/com/cortez/samples/jpaperformance/bean/LazyBeanTest.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.bean; 2 | 3 | import com.cortez.samples.jpaperformance.data.LazyEntity; 4 | import org.jboss.arquillian.container.test.api.Deployment; 5 | import org.jboss.arquillian.junit.Arquillian; 6 | import org.jboss.shrinkwrap.api.ShrinkWrap; 7 | import org.jboss.shrinkwrap.api.spec.WebArchive; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import javax.inject.Inject; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | import static org.junit.Assert.assertNotNull; 16 | 17 | /** 18 | * @author Roberto Cortez 19 | */ 20 | @RunWith(Arquillian.class) 21 | public class LazyBeanTest { 22 | @Inject 23 | private LazyBean lazyBean; 24 | 25 | private static List results = new ArrayList<>(); 26 | 27 | @Deployment 28 | public static WebArchive createDeployment() { 29 | WebArchive war = ShrinkWrap.create(WebArchive.class) 30 | .addClass(LazyEntity.class) 31 | .addClass(LazyBean.class) 32 | .addAsResource("META-INF/persistence.xml"); 33 | System.out.println(war.toString(true)); 34 | return war; 35 | } 36 | 37 | @Test 38 | public void testFindLazyEntity() throws Exception { 39 | LazyEntity lazyEntity = lazyBean.find(1L); 40 | assertNotNull(lazyEntity.getId()); 41 | 42 | assertNotNull(lazyEntity.getProperty01()); 43 | /* 44 | System.out.println("lazyEntity.getProperty01() = " + lazyEntity.getProperty01()); 45 | assertNotNull(lazyEntity.getProperty02()); 46 | assertNotNull(lazyEntity.getProperty03()); 47 | assertNotNull(lazyEntity.getProperty04()); 48 | assertNotNull(lazyEntity.getProperty05()); 49 | assertNotNull(lazyEntity.getProperty06()); 50 | assertNotNull(lazyEntity.getProperty07()); 51 | assertNotNull(lazyEntity.getProperty08()); 52 | assertNotNull(lazyEntity.getProperty09()); 53 | assertNotNull(lazyEntity.getProperty10());*/ 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/cortez/samples/jpaperformance/bean/PerformanceBeanTest.java: -------------------------------------------------------------------------------- 1 | package com.cortez.samples.jpaperformance.bean; 2 | 3 | import com.cortez.samples.jpaperformance.data.DepartmentEntity; 4 | import com.cortez.samples.jpaperformance.data.EmployeeEntity; 5 | import org.jboss.arquillian.container.test.api.Deployment; 6 | import org.jboss.arquillian.junit.Arquillian; 7 | import org.jboss.shrinkwrap.api.ShrinkWrap; 8 | import org.jboss.shrinkwrap.api.spec.WebArchive; 9 | import org.jboss.shrinkwrap.resolver.api.maven.Maven; 10 | import org.junit.After; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | 14 | import javax.inject.Inject; 15 | import java.io.File; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * @author Roberto Cortez 21 | */ 22 | @RunWith(Arquillian.class) 23 | public class PerformanceBeanTest { 24 | @Inject 25 | private PerformanceBean performanceBean; 26 | 27 | private static List results = new ArrayList<>(); 28 | 29 | @Deployment 30 | public static WebArchive createDeployment() { 31 | File[] requiredLibraries = Maven.resolver().loadPomFromFile("pom.xml") 32 | .resolve("org.apache.commons:commons-lang3", 33 | "commons-beanutils:commons-beanutils") 34 | .withTransitivity().asFile(); 35 | 36 | WebArchive war = ShrinkWrap.create(WebArchive.class) 37 | .addClass(DepartmentEntity.class) 38 | .addClass(EmployeeEntity.class) 39 | .addClass(PerformanceBean.class) 40 | .addAsResource("META-INF/persistence.xml") 41 | .addAsLibraries(requiredLibraries); 42 | 43 | System.out.println(war.toString(true)); 44 | return war; 45 | } 46 | 47 | @Test 48 | public void testFindAll() { 49 | System.out.println("PerformanceBeanTest.testFindAll"); 50 | long start = System.currentTimeMillis(); 51 | List all = performanceBean.findAll(); 52 | long end = System.currentTimeMillis(); 53 | results.add("Time for findAll: " + (end - start)); 54 | System.out.println("Elements for findAll: " + all.size()); 55 | } 56 | 57 | @Test 58 | public void testFindAllNeededColumns() { 59 | System.out.println("PerformanceBeanTest.testFindAllNeededColumns"); 60 | long start = System.currentTimeMillis(); 61 | performanceBean.findAllNeededColumns(); 62 | long end = System.currentTimeMillis(); 63 | results.add("Time for findAllNeededColumns: " + (end - start)); 64 | } 65 | 66 | @Test 67 | public void testFindAllNeededColumnsPaginated() { 68 | System.out.println("PerformanceBeanTest.testFindAllNeededColumnsPaginated"); 69 | long start = System.currentTimeMillis(); 70 | performanceBean.findAllNeededColumnsPaginated(); 71 | long end = System.currentTimeMillis(); 72 | results.add("Time for findAllNeededColumnsPaginated: " + (end - start)); 73 | } 74 | 75 | @Test 76 | public void testFindAllEager() throws Exception { 77 | System.out.println("PerformanceBeanTest.testFindAllEager"); 78 | long start = System.currentTimeMillis(); 79 | performanceBean.findAllEager(); 80 | long end = System.currentTimeMillis(); 81 | results.add("Time for findAllEager: " + (end - start)); 82 | } 83 | 84 | @Test 85 | public void testFindAllLazy() throws Exception { 86 | System.out.println("PerformanceBeanTest.testFindAllLazy"); 87 | long start = System.currentTimeMillis(); 88 | performanceBean.findAllLazy(); 89 | long end = System.currentTimeMillis(); 90 | results.add("Time for findAllLazy: " + (end - start)); 91 | } 92 | 93 | @Test 94 | public void testFindAllFetchLazy() throws Exception { 95 | System.out.println("PerformanceBeanTest.testFindAllFetchLazy"); 96 | long start = System.currentTimeMillis(); 97 | performanceBean.findAllFetchLazy(); 98 | long end = System.currentTimeMillis(); 99 | results.add("Time for findAllFetchLazy: " + (end - start)); 100 | } 101 | 102 | @After 103 | public void tearDown() throws Exception { 104 | System.out.println("PerformanceBeanTest.tearDown"); 105 | for (String result : results) { 106 | System.out.println(result); 107 | } 108 | } 109 | } 110 | --------------------------------------------------------------------------------