what is the best way to access relationship objects to avoid lazyload exception?

10 views
Skip to first unread message

msa...@astound.net

unread,
Apr 12, 2018, 6:16:26 PM4/12/18
to Light Admin Group

I am trying to add a functionality to visualize relationships between data object in a generic way to. I have devised a mechanism allowing other applications that use the core lightadmin jar to extend and provide a JSON object i need to display data using D3 library.  internally in lightadmin code, when i try to convert the data into needed JSON, i get lazy load exception when i try to traverse deep into relationships to create a viable metal picture of data for the D# library.

What is the best way to access related object when i try to get , for example, address instance of a customer instance? or customer instance of an order instance?

I have started by accessing DomainTypeAdministrationConfiguration of global administration object. then i loop through them and if i find a field name or field UUID in each configuration that is in the list of configurations, then i assume it is a relationship.. and when i try to invoke java reflection on a field on the object i get lazy load exception.. i tried with accessing method and got the same exception.. i have also tried finding the entity manager and invoke unwrap() method on it to get the session, but i get entity manager do not exist exception...

I imagine there is a better way through JPA to do all of this.. if you can help me on this, you will end up with an amazing new functionality on lightadmin application.. So.. hurry up and help me out to get this functionality on your side as soon as possible!!
StandardVisualizer.java
Reply all
Reply to author
Forward
0 new messages