Hi Alex I assume item is an instance of the parznt class, right? How do you load the item instance? Is the discriminator column valid?
Le mar. 16 avr. 2019 à 23:01, Alexander Benett <[email protected]> a écrit : > Hello, > > We use OpenJPA in our project and had noticed some strange behavior a > while ago when child entity classes are not loaded into parent class entity. > > Db setup: table called item with 2 primary keys (id and sales device id), > table called promotion with 2 primary keys (id and sales device id) > Java setup: Item.java is configured with annotation > @Inheritance(strategy=InheritanceType.JOINED) and Promotion.java which > extends Item and has no id fields. > The class Item is in the TransactionItem class and TransactionItem belongs > to Transaction. > We have configured all entities as EAGER LOADING, however what we noticed > that when transaction is closed and sent to print a receipt, > “item instanseof Promotion” is sometimes false. Both item and promotion > records do exist in db. > Interesting thing is that “item instanseof Promotion” had worked fine for > many years and only lately began to fail, however code in this area was not > changed for a long time. > Another problem is that we could never reproduce this issue in our env but > it consistently happens in prod. > Is that possible that some entities in the transaction are not fully > loaded or in process of loading while transaction is closed and parsed to > generate a receipt? > Recently we had to implement an additional procedure to explicitly load an > item from db into each trans item directly, but “item instanseof Promotion” > is still sometimes false. This issue is particularly crucial for us because > transaction total is not calculated correctly on a receipt as promotion > item is not identified as promotion. > > It seems like maybe we reach some limit for loaded entities, however it’s > not really clear what to look for > Only one thing I could say is over last couple of years more and more > tables were added to the db and some of them are a part of the transaction > > Thanks > Alex > > > > > > > Alexander Benett > Senior Java Developer - CarWash Controls > [https://www.sonnysdirect.com/medias/sys-master/h8f/h88/9469105307678.png] > Tel: (954) 720-4102 > [https://www.sonnysdirect.com/medias/sys-master/h04/h2d/9469105799198.png] > [email protected]<mailto:[email protected]> > www.SonnysDirect.com<http://www.sonnysdirect.com/> > 5605 Hiatus Road, Tamarac, FL, 33321 > [https://www.sonnysdirect.com/medias/sys-master/hc9/h87/9469104488478.png > ]<https://www.youtube.com/user/sonnyscarwashfactory> [ > https://www.sonnysdirect.com/medias/sys-master/hd6/h50/9469103046686.png] > <https://www.facebook.com/SonnysCarWashEquipment> [ > https://www.sonnysdirect.com/medias/sys-master/ha0/h29/9469103472670.png] > <https://www.linkedin.com/company/sonny's-enterprises> [ > https://www.sonnysdirect.com/medias/sys-master/images/hda/hbc/9469104160798.png] > <https://twitter.com/sonnysdirect> [ > https://www.sonnysdirect.com/medias/sys-master/h59/h61/9469105733662.png] > > > > >
