java - Lazy Fetching doesn't work with many to one -


i have class a has 1 many relationship b, when want fetch b don't want fetch a, means want lazy fetching, in case code looks (didn't write setter , getter methods)

@jsoninclude(jsoninclude.include.non_null) @jsonignoreproperties(value = {"hibernatelazyinitializer", "handler"}, ignoreunknown = true) @generated("org.jsonschema2pojo") @entity public class b{    @manytoone(fetch = fetchtype.lazy, cascade = cascadetype.all, optional = false)   @joincolumn(name = "aid")   private a; }   @jsoninclude(jsoninclude.include.non_null) @jsonignoreproperties(value = {"hibernatelazyinitializer", "handler"}, ignoreunknown = true) @generated("org.jsonschema2pojo") @entity public class  {    @onetomany(mappedby = "a", fetch = fetchtype.lazy, cascade = cascadetype.all)   private set<b> bs; } 

the problem given infinite recursion, b contains , contains bs , on, tried use @jsonbackreference() @ manytoone , @jsonmanagedreference() @ onetomany , solved recursion issue fetching still eager not lazy. also, don't want use @jsonignore since point not sending query fetch a.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -