JPA дерево кидает Unable to access lob stream

233
08 марта 2018, 10:49

У меня есть сущность:

@Entity
public class CollectionJpa {
    @Id
    @Getter
    @Setter
    int id;
    @Getter
    @Setter
    @ManyToOne
    CollectionJpa parent;
    @Getter
    @Setter
    @OneToMany(mappedBy = "parent")
    Set<CollectionJpa> childs;
    //.....
}

пытаюсь получить нужную коллекцию. Hibernate делает вот такой запрос:

select childs0_.parent_id as parent_17_5_0_, childs0_.id as id1_5_0_, childs0_.id as id1_5_1_, childs0_.created_at as created_2_5_1_, childs0_.description as descript3_5_1_, childs0_.html_title as html_tit4_5_1_, childs0_.image_id as image_i16_5_1_, childs0_.is_hidden as is_hidde5_5_1_, childs0_.meta_description as meta_des6_5_1_, childs0_.meta_keywords as meta_key7_5_1_, childs0_.parent_id as parent_17_5_1_, childs0_.permalink as permalin8_5_1_, childs0_.position as position9_5_1_, childs0_.recursive as recursi10_5_1_, childs0_.seo_description as seo_des11_5_1_, childs0_.sort_type as sort_ty12_5_1_, childs0_.title as title13_5_1_, childs0_.updated_at as updated14_5_1_, childs0_.url as url15_5_1_, imagejpa1_.id as id1_6_2_, imagejpa1_.compact_url as compact_2_6_2_, imagejpa1_.created_at as created_3_6_2_, imagejpa1_.external_id as external4_6_2_, imagejpa1_.filename as filename5_6_2_, imagejpa1_.image_processing as image_pr6_6_2_, imagejpa1_.large_url as large_ur7_6_2_, imagejpa1_.medium_url as medium_u8_6_2_, imagejpa1_.original_url as original9_6_2_, imagejpa1_.position as positio10_6_2_, imagejpa1_.product_id as product15_6_2_, imagejpa1_.small_url as small_u11_6_2_, imagejpa1_.thumb_url as thumb_u12_6_2_, imagejpa1_.title as title13_6_2_, imagejpa1_.url as url14_6_2_, productjpa2_.id as id1_11_3_, productjpa2_.archived as archived2_11_3_, productjpa2_.available as availabl3_11_3_, productjpa2_.canonical_url_collection_id as canonica4_11_3_, productjpa2_.categorie_id as categor15_11_3_, productjpa2_.created_at as created_5_11_3_, productjpa2_.currency_code as currency6_11_3_, productjpa2_.description as descript7_11_3_, productjpa2_.ignore_discounts as ignore_d8_11_3_, productjpa2_.is_hidden as is_hidde9_11_3_, productjpa2_.permalink as permali10_11_3_, productjpa2_.short_description as short_d11_11_3_, productjpa2_.title as title12_11_3_, productjpa2_.unit as unit13_11_3_, productjpa2_.updated_at as updated14_11_3_, categoriej3_.id as id1_3_4_, categoriej3_.created_at as created_2_3_4_, categoriej3_.parent_id as parent_i6_3_4_, categoriej3_.position as position3_3_4_, categoriej3_.title as title4_3_4_, categoriej3_.updated_at as updated_5_3_4_, categoriej4_.id as id1_3_5_, categoriej4_.created_at as created_2_3_5_, categoriej4_.parent_id as parent_i6_3_5_, categoriej4_.position as position3_3_5_, categoriej4_.title as title4_3_5_, categoriej4_.updated_at as updated_5_3_5_ from collections childs0_ left outer join images imagejpa1_ on childs0_.image_id=imagejpa1_.id left outer join products productjpa2_ on imagejpa1_.product_id=productjpa2_.id left outer join categories categoriej3_ on productjpa2_.categorie_id=categoriej3_.id left outer join categories categoriej4_ on categoriej3_.parent_id=categoriej4_.id where childs0_.parent_id=?

И кидает исключение:

Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON document: Unable to access lob stream (through reference chain: DataBase.dao.Entities.CollectionJpa["parent"]->DataBase.dao.Entities.CollectionJpa["childs"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unable to access lob stream (through reference chain: DataBase.dao.Entities.CollectionJpa["parent"]->DataBase.dao.Entities.CollectionJpa["childs"])

Что я делаю не так? Это же стандартная связь..

READ ALSO
Адаптер в RecyclerView

Адаптер в RecyclerView

В общем создал BottomNavigationBar ActivityВ нем еще два фрагмента разделенная через Tabbed menu

188
Java =&gt; C++ code

Java => C++ code

Как можно реализовать на c++ данный код на Java:

264
TreeMap не правильно сортирует

TreeMap не правильно сортирует

TreeMap не правильно сортирует

284