1 package org.kuali.rice.krad.data.jpa.eclipselink;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.junit.Test;
5 import org.kuali.rice.krad.bo.DataObjectBase;
6 import org.kuali.rice.krad.data.jpa.FilterGenerator;
7 import org.kuali.rice.krad.data.jpa.FilterGenerators;
8 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
9 import org.kuali.rice.krad.data.provider.annotation.ExtensionFor;
10 import org.kuali.rice.krad.test.KRADTestCase;
11 import org.kuali.rice.krad.test.document.bo.SimpleAccount;
12 import org.springframework.context.ConfigurableApplicationContext;
13 import org.springframework.context.support.ClassPathXmlApplicationContext;
14
15 import javax.persistence.Access;
16 import javax.persistence.AccessType;
17 import javax.persistence.Column;
18 import javax.persistence.Entity;
19 import javax.persistence.EntityManager;
20 import javax.persistence.EntityManagerFactory;
21 import javax.persistence.FetchType;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.ManyToOne;
26 import javax.persistence.MappedSuperclass;
27 import javax.persistence.OneToMany;
28 import javax.persistence.OrderBy;
29 import javax.persistence.Table;
30
31 import java.util.ArrayList;
32 import java.util.List;
33
34 import static org.junit.Assert.*;
35
36
37
38
39
40
41 public class KradEclipseLinkCustomizerTest extends KRADTestCase {
42
43 private ConfigurableApplicationContext context;
44
45 @Override
46 protected void setUpInternal() throws Exception {
47 super.setUpInternal();
48 context = new ClassPathXmlApplicationContext("KradEclipseLinkCustomizerTest.xml", getClass());
49 }
50
51 @Override
52 public void tearDown() throws Exception {
53 if (context != null) {
54 context.close();
55 }
56 super.tearDown();
57 }
58
59 @Test
60 public void testSequences_AnnotationAtClassLevel() throws Exception {
61 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
62 assertNotNull(factory);
63
64 TestEntity testEntity1 = new TestEntity();
65 testEntity1.setName("MyAwesomeTestEntity1");
66
67
68 assertNull(testEntity1.getNumber());
69
70 EntityManager entityManager = factory.createEntityManager();
71 try {
72 entityManager.persist(testEntity1);
73 assertNotNull(testEntity1.getNumber());
74 } finally {
75 entityManager.close();
76 }
77
78 TestEntity testEntity2 = new TestEntity();
79 testEntity2.setName("MyAwesomeTestEntity2");
80
81 assertNull(testEntity2.getNumber());
82
83 entityManager = factory.createEntityManager();
84 try {
85
86 testEntity2 = entityManager.merge(testEntity2);
87 assertNotNull(testEntity2.getNumber());
88 assertEquals(Integer.valueOf(Integer.valueOf(testEntity1.getNumber()).intValue() + 1), Integer.valueOf(
89 testEntity2.getNumber()));
90 } finally {
91 entityManager.close();
92 }
93
94 }
95
96 @Test
97 public void testSequences_AnnotationAtFieldLevel() throws Exception {
98 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
99 assertNotNull(factory);
100
101 TestEntity2 testEntity1 = new TestEntity2();
102 testEntity1.setName("MyAwesomeTestEntity1");
103
104
105 assertNull(testEntity1.getNumber());
106
107 EntityManager entityManager = factory.createEntityManager();
108 try {
109 entityManager.persist(testEntity1);
110 assertNotNull(testEntity1.getNumber());
111 } finally {
112 entityManager.close();
113 }
114
115 TestEntity2 testEntity2 = new TestEntity2();
116 testEntity2.setName("MyAwesomeTestEntity2");
117
118 assertNull(testEntity2.getNumber());
119
120 entityManager = factory.createEntityManager();
121 try {
122
123 testEntity2 = entityManager.merge(testEntity2);
124 assertNotNull(testEntity2.getNumber());
125 assertEquals(Integer.valueOf(Integer.valueOf(testEntity1.getNumber()).intValue() + 1), Integer.valueOf(
126 testEntity2.getNumber()));
127 } finally {
128 entityManager.close();
129 }
130
131 }
132
133 @Test
134 public void testSequences_AnnotationAtFieldLevel_MappedSuperClass() throws Exception {
135 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
136 assertNotNull(factory);
137
138 TestEntity5 testEntity1 = new TestEntity5();
139 testEntity1.setName("MyAwesomeTestEntity1");
140
141
142 assertNull(testEntity1.getNumber());
143
144 EntityManager entityManager = factory.createEntityManager();
145 try {
146 entityManager.persist(testEntity1);
147 assertNotNull(testEntity1.getNumber());
148 } finally {
149 entityManager.close();
150 }
151
152 TestEntity5 testEntity2 = new TestEntity5();
153 testEntity2.setName("MyAwesomeTestEntity2");
154
155 assertNull(testEntity2.getNumber());
156
157 entityManager = factory.createEntityManager();
158 try {
159
160 testEntity2 = entityManager.merge(testEntity2);
161 assertNotNull(testEntity2.getNumber());
162 assertEquals(Integer.valueOf(Integer.valueOf(testEntity1.getNumber()).intValue() + 1), Integer.valueOf(
163 testEntity2.getNumber()));
164 } finally {
165 entityManager.close();
166 }
167
168 }
169
170 @Test
171 public void testSequences_AnnotationAtMethodLevel() throws Exception {
172 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
173 assertNotNull(factory);
174
175 TestEntity3 testEntity1 = new TestEntity3();
176 testEntity1.setName("MyAwesomeTestEntity1");
177
178
179 assertNull(testEntity1.getNumber());
180
181 EntityManager entityManager = factory.createEntityManager();
182 try {
183 entityManager.persist(testEntity1);
184 assertNotNull(testEntity1.getNumber());
185 } finally {
186 entityManager.close();
187 }
188
189 TestEntity3 testEntity2 = new TestEntity3();
190 testEntity2.setName("MyAwesomeTestEntity2");
191
192 assertNull(testEntity2.getNumber());
193
194 entityManager = factory.createEntityManager();
195 try {
196
197 testEntity2 = entityManager.merge(testEntity2);
198 assertNotNull(testEntity2.getNumber());
199 assertEquals(Integer.valueOf(Integer.valueOf(testEntity1.getNumber()).intValue() + 1), Integer.valueOf(
200 testEntity2.getNumber()));
201 } finally {
202 entityManager.close();
203 }
204
205 }
206
207 @Test
208 public void testSequences_MappedSuperClass() throws Exception {
209 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
210 assertNotNull(factory);
211
212 TestEntity4 testEntity1 = new TestEntity4();
213 testEntity1.setName("MyAwesomeTestEntity1");
214
215
216 assertNull(testEntity1.getNumber());
217
218 EntityManager entityManager = factory.createEntityManager();
219 try {
220 entityManager.persist(testEntity1);
221 assertNotNull(testEntity1.getNumber());
222 } finally {
223 entityManager.close();
224 }
225
226 TestEntity4 testEntity2 = new TestEntity4();
227 testEntity2.setName("MyAwesomeTestEntity2");
228
229 assertNull(testEntity2.getNumber());
230
231 entityManager = factory.createEntityManager();
232 try {
233
234 testEntity2 = entityManager.merge(testEntity2);
235 assertNotNull(testEntity2.getNumber());
236 assertEquals(Integer.valueOf(Integer.valueOf(testEntity1.getNumber()).intValue() + 1), Integer.valueOf(
237 testEntity2.getNumber()));
238 } finally {
239 entityManager.close();
240 }
241
242 }
243
244
245
246
247
248 @Entity
249 @Table(name = "TRV_ACCT")
250 @PortableSequenceGenerator(name = "TRVL_ID_SEQ")
251 public static class TestEntity extends DataObjectBase {
252
253 @Id @Column(name = "ACCT_NUM") @GeneratedValue(generator = "TRVL_ID_SEQ")
254 private String number;
255
256 @Column(name = "ACCT_NAME")
257 private String name;
258
259 @Column(name = "ACCT_FO_ID")
260 private Long amId;
261
262 public Long getAmId() {
263 return amId;
264 }
265
266 public void setAmId(Long amId) {
267 this.amId = amId;
268 }
269
270 public String getName() {
271 return name;
272 }
273
274 public void setName(String name) {
275 this.name = name;
276 }
277
278 public String getNumber() {
279 return number;
280 }
281
282 public void setNumber(String number) {
283 this.number = number;
284 }
285 }
286
287
288
289
290
291 @Entity
292 @Table(name = "TRV_ACCT")
293 public static class TestEntity2 extends DataObjectBase {
294
295 @Id @GeneratedValue(generator = "TRVL_ID_SEQ_2") @PortableSequenceGenerator(name = "TRVL_ID_SEQ_2",
296 sequenceName = "TRVL_ID_SEQ") @Column(name = "ACCT_NUM")
297 private String number;
298
299 @Column(name = "ACCT_NAME")
300 private String name;
301
302 @Column(name = "ACCT_FO_ID")
303 private Long amId;
304
305 public Long getAmId() {
306 return amId;
307 }
308
309 public void setAmId(Long amId) {
310 this.amId = amId;
311 }
312
313 public String getName() {
314 return name;
315 }
316
317 public void setName(String name) {
318 this.name = name;
319 }
320
321 public String getNumber() {
322 return number;
323 }
324
325 public void setNumber(String number) {
326 this.number = number;
327 }
328 }
329
330
331
332
333
334 @Entity
335 @Table(name = "TRV_ACCT")
336 @Access(AccessType.PROPERTY)
337 public static class TestEntity3 extends DataObjectBase {
338
339 private String number;
340 private String name;
341 private Long amId;
342
343 @Column(name = "ACCT_FO_ID")
344 public Long getAmId() {
345 return amId;
346 }
347
348 public void setAmId(Long amId) {
349 this.amId = amId;
350 }
351
352 @Column(name = "ACCT_NAME")
353 public String getName() {
354 return name;
355 }
356
357 public void setName(String name) {
358 this.name = name;
359 }
360
361 @Id
362 @GeneratedValue(generator = "TRVL_ID_SEQ_3")
363 @PortableSequenceGenerator(name = "TRVL_ID_SEQ_3", sequenceName = "TRVL_ID_SEQ")
364 @Column(name = "ACCT_NUM")
365 public String getNumber() {
366 return number;
367 }
368
369 public void setNumber(String number) {
370 this.number = number;
371 }
372 }
373
374 @MappedSuperclass
375 @PortableSequenceGenerator(name = "TRVL_ID_SEQ_4", sequenceName = "TRVL_ID_SEQ", initialValue = 1000)
376 public abstract static class ParentTestEntity extends DataObjectBase {
377
378 public abstract String getNumber();
379
380 }
381
382 @Entity
383 @Table(name = "TRV_ACCT")
384 public static class TestEntity4 extends ParentTestEntity {
385
386 @Id @GeneratedValue(generator = "TRVL_ID_SEQ_4") @Column(name = "ACCT_NUM")
387 private String number;
388
389 @Column(name = "ACCT_NAME")
390 private String name;
391
392 @Column(name = "ACCT_FO_ID")
393 private Long amId;
394
395 public String getNumber() {
396 return number;
397 }
398
399 public void setNumber(String number) {
400 this.number = number;
401 }
402
403 public Long getAmId() {
404 return amId;
405 }
406
407 public void setAmId(Long amId) {
408 this.amId = amId;
409 }
410
411 public String getName() {
412 return name;
413 }
414
415 public void setName(String name) {
416 this.name = name;
417 }
418
419 }
420
421 @MappedSuperclass
422 public abstract static class ParentTestEntity2 extends DataObjectBase {
423
424 @Id @GeneratedValue(generator = "TRVL_ID_SEQ_5") @PortableSequenceGenerator(name = "TRVL_ID_SEQ_5",
425 sequenceName = "TRVL_ID_SEQ", initialValue = 1000) @Column(name = "ACCT_NUM")
426 private String number;
427
428 public String getNumber() {
429 return number;
430 }
431
432 public void setNumber(String number) {
433 this.number = number;
434 }
435
436 }
437
438 @Entity
439 @Table(name = "TRV_ACCT")
440 public static class TestEntity5 extends ParentTestEntity2 {
441
442 @Column(name = "ACCT_NAME")
443 private String name;
444
445 @Column(name = "ACCT_FO_ID")
446 private Long amId;
447
448 public Long getAmId() {
449 return amId;
450 }
451
452 public void setAmId(Long amId) {
453 this.amId = amId;
454 }
455
456 public String getName() {
457 return name;
458 }
459
460 public void setName(String name) {
461 this.name = name;
462 }
463
464 }
465
466 @Test
467 public void testQueryCustomizerMatch() throws Exception {
468 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
469 assertNotNull(factory);
470
471 TestEntity6 testEntity1 = new TestEntity6();
472 testEntity1.setName("MyAwesomeTestEntity1");
473
474 TestRelatedExtension extension = new TestRelatedExtension();
475 extension.setAccountTypeCode("TS");
476
477 EntityManager entityManager = factory.createEntityManager();
478
479 try {
480 testEntity1 = new TestEntity6();
481 testEntity1.setName("MyCustomFilter");
482 entityManager.persist(testEntity1);
483 extension.setNumber(testEntity1.getNumber());
484 entityManager.persist(extension);
485 entityManager.flush();
486 } finally {
487 entityManager.close();
488 }
489
490
491 try {
492 entityManager = factory.createEntityManager();
493 testEntity1 = entityManager.find(TestEntity6.class, testEntity1.getNumber());
494 assertTrue("Match found for base entity", testEntity1 != null && StringUtils.equals("MyCustomFilter",
495 testEntity1.getName()));
496 assertTrue("Found matching travel extension that matches", testEntity1.getAccountExtension() != null);
497 } finally {
498 entityManager.close();
499 }
500
501 }
502
503 @Test
504 public void testQueryCustomizerNoMatch() throws Exception {
505 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
506 assertNotNull(factory);
507
508 TestEntity6 testEntity1 = new TestEntity6();
509 testEntity1.setName("MyAwesomeTestEntity1");
510
511 TestRelatedExtension extension = new TestRelatedExtension();
512 extension.setAccountTypeCode("NM");
513
514 EntityManager entityManager = factory.createEntityManager();
515
516 try {
517 testEntity1 = new TestEntity6();
518 testEntity1.setName("MyCustomFilter");
519 entityManager.persist(testEntity1);
520 extension.setNumber(testEntity1.getNumber());
521 entityManager.persist(extension);
522 entityManager.flush();
523 } finally {
524 entityManager.close();
525 }
526
527
528 try {
529 entityManager = factory.createEntityManager();
530 testEntity1 = entityManager.find(TestEntity6.class, testEntity1.getNumber());
531 assertTrue("Matched found for base entity", testEntity1 != null && StringUtils.equals("MyCustomFilter",
532 testEntity1.getName()));
533 assertTrue("No matching travel extension", testEntity1.getAccountExtension() == null);
534 } finally {
535 entityManager.close();
536 }
537
538 }
539
540 @Test
541 public void testQueryCustomizerSort() throws Exception {
542 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
543 assertNotNull(factory);
544
545 TestEntity7 testEntity1 = new TestEntity7();
546 testEntity1.setName("MyAwesomeTestEntity1");
547
548 TestRelatedExtension2 extension2 = new TestRelatedExtension2();
549 extension2.setAccountTypeCode("ZZ");
550
551 TestRelatedExtension2 extension = new TestRelatedExtension2();
552 extension.setAccountTypeCode("NM");
553
554 EntityManager entityManager = factory.createEntityManager();
555
556 try {
557 testEntity1 = new TestEntity7();
558 testEntity1.setName("MyCustomFilter");
559 entityManager.persist(testEntity1);
560 extension.setNumber(testEntity1.getNumber());
561 entityManager.persist(extension);
562 entityManager.flush();
563 } finally {
564 entityManager.close();
565 }
566
567 try {
568 entityManager = factory.createEntityManager();
569 extension2.setNumber(testEntity1.getNumber());
570 entityManager.persist(extension2);
571 entityManager.flush();
572 } finally {
573 entityManager.close();
574 }
575
576 entityManager = factory.createEntityManager();
577
578
579 try {
580 entityManager = factory.createEntityManager();
581 testEntity1 = entityManager.find(TestEntity7.class, testEntity1.getNumber());
582 assertTrue("Matched found for base entity", testEntity1 != null && StringUtils.equals("MyCustomFilter",
583 testEntity1.getName()));
584 assertTrue("Fetching 2 extensions",
585 testEntity1.getAccountExtension() != null && testEntity1.getAccountExtension().size() == 2);
586 assertTrue("Fetched ZZ extension first ", StringUtils.equals(testEntity1.getAccountExtension().get(0)
587 .getAccountTypeCode(), "ZZ"));
588 } finally {
589 entityManager.close();
590 }
591
592 }
593
594 @Test
595 public void testQueryCustomizerValueClass() throws Exception {
596 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
597 assertNotNull(factory);
598
599 TestEntity8 testEntity1 = new TestEntity8();
600 testEntity1.setName("MyAwesomeTestEntity1");
601
602 TestRelatedExtension extension = new TestRelatedExtension();
603 extension.setAccountTypeCode("NM");
604
605 EntityManager entityManager = factory.createEntityManager();
606
607 try {
608 testEntity1 = new TestEntity8();
609 testEntity1.setName("MyCustomFilter");
610 entityManager.persist(testEntity1);
611 extension.setNumber(testEntity1.getNumber());
612 entityManager.persist(extension);
613 entityManager.flush();
614 } finally {
615 entityManager.close();
616 }
617
618
619 try {
620 entityManager = factory.createEntityManager();
621 testEntity1 = entityManager.find(TestEntity8.class, testEntity1.getNumber());
622 assertTrue("Matched found for base entity", testEntity1 != null && StringUtils.equals("MyCustomFilter",
623 testEntity1.getName()));
624 assertTrue("Matching travel extension", testEntity1.getAccountExtension() == null);
625 } finally {
626 entityManager.close();
627 }
628
629 }
630
631 @Test
632 public void testQueryCustomizerNoMatchMultipleCustomizers() throws Exception {
633 EntityManagerFactory factory = (EntityManagerFactory) context.getBean("entityManagerFactory");
634 assertNotNull(factory);
635
636 TestEntity9 testEntity1 = new TestEntity9();
637 testEntity1.setName("MyAwesomeTestEntity1");
638
639 TestRelatedExtension extension = new TestRelatedExtension();
640 extension.setAccountTypeCode("TS");
641
642 EntityManager entityManager = factory.createEntityManager();
643
644 try {
645 testEntity1 = new TestEntity9();
646 testEntity1.setName("MyCustomFilter");
647 entityManager.persist(testEntity1);
648 extension.setNumber(testEntity1.getNumber());
649 entityManager.persist(extension);
650 entityManager.flush();
651 } finally {
652 entityManager.close();
653 }
654
655
656 try {
657 entityManager = factory.createEntityManager();
658 testEntity1 = entityManager.find(TestEntity9.class, testEntity1.getNumber());
659 assertTrue("Match found for base entity", testEntity1 != null && StringUtils.equals("MyCustomFilter",
660 testEntity1.getName()));
661 assertTrue("Found no travel extension that matches", testEntity1.getAccountExtension() == null);
662 } finally {
663 entityManager.close();
664 }
665
666 }
667
668 @Entity
669 @Table(name = "TRV_ACCT")
670 public static class TestEntity6 extends ParentTestEntity2 {
671
672 @ManyToOne(targetEntity = TestRelatedExtension.class, fetch = FetchType.EAGER) @JoinColumn(name = "ACCT_NUM",
673 insertable = false, updatable = false) @FilterGenerator(attributeName = "accountTypeCode",
674 attributeValue = "TS")
675 private TestRelatedExtension accountExtension;
676
677 @Column(name = "ACCT_NAME")
678 private String name;
679
680 @Column(name = "ACCT_FO_ID")
681 private Long amId;
682
683 public Long getAmId() {
684 return amId;
685 }
686
687 public void setAmId(Long amId) {
688 this.amId = amId;
689 }
690
691 public String getName() {
692 return name;
693 }
694
695 public void setName(String name) {
696 this.name = name;
697 }
698
699 public TestRelatedExtension getAccountExtension() {
700 return accountExtension;
701 }
702
703 public void setAccountExtension(TestRelatedExtension accountExtension) {
704 this.accountExtension = accountExtension;
705 }
706 }
707
708 @Entity
709 @Table(name = "TRV_ACCT_EXT")
710 @ExtensionFor(SimpleAccount.class)
711 public static class TestRelatedExtension extends DataObjectBase {
712
713 @Id @Column(name = "ACCT_NUM")
714 private String number;
715 @Column(name = "ACCT_TYPE")
716 private String accountTypeCode;
717
718 public String getNumber() {
719 return number;
720 }
721
722 public void setNumber(String number) {
723 this.number = number;
724 }
725
726 public String getAccountTypeCode() {
727 return accountTypeCode;
728 }
729
730 public void setAccountTypeCode(String accountTypeCode) {
731 this.accountTypeCode = accountTypeCode;
732 }
733 }
734
735 @Entity
736 @Table(name = "TRV_ACCT")
737 public static class TestEntity7 extends ParentTestEntity2 {
738
739 @OneToMany(targetEntity = TestRelatedExtension2.class, fetch = FetchType.EAGER) @JoinColumn(
740 name = "ACCT_NUM") @OrderBy("accountTypeCode DESC")
741 private List<TestRelatedExtension2> accountExtension = new ArrayList<TestRelatedExtension2>();
742
743 @Column(name = "ACCT_NAME")
744 private String name;
745
746 @Column(name = "ACCT_FO_ID")
747 private Long amId;
748
749 public Long getAmId() {
750 return amId;
751 }
752
753 public void setAmId(Long amId) {
754 this.amId = amId;
755 }
756
757 public String getName() {
758 return name;
759 }
760
761 public void setName(String name) {
762 this.name = name;
763 }
764
765 public List<TestRelatedExtension2> getAccountExtension() {
766 return accountExtension;
767 }
768
769 public void setAccountExtension(List<TestRelatedExtension2> accountExtension) {
770 this.accountExtension = accountExtension;
771 }
772
773 }
774
775 @Entity
776 @Table(name = "TRV_ACCT_EXT")
777 public static class TestRelatedExtension2 extends DataObjectBase {
778
779 @Id @Column(name = "ACCT_NUM")
780 private String number;
781 @Id @Column(name = "ACCT_TYPE")
782 private String accountTypeCode;
783
784 @ManyToOne(targetEntity = TestEntity7.class, fetch = FetchType.EAGER) @JoinColumn(name = "ACCT_NUM",
785 insertable = false, updatable = false)
786 private TestEntity7 testEntity7;
787
788 public String getNumber() {
789 return number;
790 }
791
792 public void setNumber(String number) {
793 this.number = number;
794 }
795
796 public String getAccountTypeCode() {
797 return accountTypeCode;
798 }
799
800 public void setAccountTypeCode(String accountTypeCode) {
801 this.accountTypeCode = accountTypeCode;
802 }
803
804 public TestEntity7 getTestEntity7() {
805 return testEntity7;
806 }
807
808 public void setTestEntity7(TestEntity7 testEntity7) {
809 this.testEntity7 = testEntity7;
810 }
811 }
812
813 @Entity
814 @Table(name = "TRV_ACCT")
815 public static class TestEntity8 extends ParentTestEntity2 {
816
817 @ManyToOne(targetEntity = TestRelatedExtension.class, fetch = FetchType.EAGER) @JoinColumn(name = "ACCT_NUM",
818 insertable = false, updatable = false) @FilterGenerator(attributeName = "accountTypeCode",
819 attributeResolverClass = org.kuali.rice.krad.data.jpa.testbo.TestQueryCustomizerValue.class)
820 private TestRelatedExtension accountExtension;
821
822 @Column(name = "ACCT_NAME")
823 private String name;
824
825 @Column(name = "ACCT_FO_ID")
826 private Long amId;
827
828 public Long getAmId() {
829 return amId;
830 }
831
832 public void setAmId(Long amId) {
833 this.amId = amId;
834 }
835
836 public String getName() {
837 return name;
838 }
839
840 public void setName(String name) {
841 this.name = name;
842 }
843
844 public TestRelatedExtension getAccountExtension() {
845 return accountExtension;
846 }
847
848 public void setAccountExtension(TestRelatedExtension accountExtension) {
849 this.accountExtension = accountExtension;
850 }
851 }
852
853 @Entity
854 @Table(name = "TRV_ACCT")
855 public static class TestEntity9 extends ParentTestEntity2 {
856
857 @ManyToOne(targetEntity = TestRelatedExtension.class, fetch = FetchType.EAGER) @JoinColumn(name = "ACCT_NUM",
858 insertable = false, updatable = false)
859 @FilterGenerators({
860 @FilterGenerator(attributeName = "accountTypeCode",attributeValue = "TS"),
861 @FilterGenerator(attributeName = "accountTypeCode",attributeValue = "NM")})
862 private TestRelatedExtension accountExtension;
863
864 @Column(name = "ACCT_NAME")
865 private String name;
866
867 @Column(name = "ACCT_FO_ID")
868 private Long amId;
869
870 public Long getAmId() {
871 return amId;
872 }
873
874 public void setAmId(Long amId) {
875 this.amId = amId;
876 }
877
878 public String getName() {
879 return name;
880 }
881
882 public void setName(String name) {
883 this.name = name;
884 }
885
886 public TestRelatedExtension getAccountExtension() {
887 return accountExtension;
888 }
889
890 public void setAccountExtension(TestRelatedExtension accountExtension) {
891 this.accountExtension = accountExtension;
892 }
893 }
894
895 }