Redis error with hibernate

Mike Barnes <mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]> Tue, 18 Dec 2018 10:33:16 -0800
Newsgroups gmane.org.user-groups.ajug.members
Message-ID <CAA71U-4ikOTk3VrCQJx6r43pfYDVp3N_QUL87j8Bit4XDSnrOg@mail.gmail.com>
--===============1353777416151909042==
Content-Type: multipart/alternative; boundary="00000000000027d04a057d502207"

--00000000000027d04a057d502207
Content-Type: text/plain; charset="UTF-8"

I am trying to use redis to handle my caching of hibernate objects. As long
as I am have not introduced Set into my entity, redis works like a champ.
However, when I use Set in my entity then Redis will store the record but
will not be able to retrieve the record and instead gives a 500 error like
the one below.

*{*
*    "timestamp": 1545154390658,*
*    "status": 500,*
*    "error": "Internal Server Error",*
*    "exception":
"org.springframework.http.converter.HttpMessageNotWritableException",*
*    "message": "Could not write JSON: failed to lazily initialize a
collection of role:
de.codeboje.springboot.tutorials.caching.model.Location.images, could not
initialize proxy - no Session; nested exception is
com.fasterxml.jackson.databind.JsonMappingException: failed to lazily
initialize a collection of role:
de.codeboje.springboot.tutorials.caching.model.Location.images, could not
initialize proxy - no Session (through reference chain:
de.codeboje.springboot.tutorials.caching.model.Location[\"images\"])",*
*    "path": "/location/1864"*
*}*


I have been pounding my head against the wall now for a while without any
idea what to do. Any help would be appreciated.

Thanks

-- 

Michael D. Barnes

Sr Software Engineer

Office: +1 404-960-9621

E-mail: mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]

Web: www.site1001.com

Follow Site 1001 on: LinkedIn <https://linkedin.com/company/site1001> |
Instagram <http://instagram.com/site1001> | Twitter
<https://twitter.com/site1001> | Facebook <http://www.facebook.com/site1001>
| YouTube <https://www.youtube.com/channel/UCmQBqlisUgdd0HjQRVFD6WQ>
20772 Carmen Loop, Suite 130
<https://www.google.com/maps/place/20772+Carmen+Loop,+Suite+130+Bend,+OR+97702>

Bend, OR 97702
<https://www.google.com/maps/place/20772+Carmen+Loop,+Suite+130+Bend,+OR+97702>

--00000000000027d04a057d502207
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">I am trying to use redis to handle my cac=
hing of hibernate objects. As long as I am have not introduced Set into my =
entity, redis works like a champ. However, when I use Set in my entity then=
 Redis will store the record but will not be able to retrieve the record an=
d instead gives a 500 error like the one below.<div><br></div><div><div><i>=
<b>{</b></i></div><div><i><b>=C2=A0 =C2=A0 &quot;timestamp&quot;: 154515439=
0658,</b></i></div><div><i><b>=C2=A0 =C2=A0 &quot;status&quot;: 500,</b></i=
></div><div><i><b>=C2=A0 =C2=A0 &quot;error&quot;: &quot;Internal Server Er=
ror&quot;,</b></i></div><div><i><b>=C2=A0 =C2=A0 &quot;exception&quot;: &qu=
ot;org.springframework.http.converter.HttpMessageNotWritableException&quot;=
,</b></i></div><div><i><b>=C2=A0 =C2=A0 &quot;message&quot;: &quot;Could no=
t write JSON: failed to lazily initialize a collection of role: de.codeboje=
.springboot.tutorials.caching.model.Location.images, could not initialize p=
roxy - no Session; nested exception is com.fasterxml.jackson.databind.JsonM=
appingException: failed to lazily initialize a collection of role: de.codeb=
oje.springboot.tutorials.caching.model.Location.images, could not initializ=
e proxy - no Session (through reference chain: de.codeboje.springboot.tutor=
ials.caching.model.Location[\&quot;images\&quot;])&quot;,</b></i></div><div=
><i><b>=C2=A0 =C2=A0 &quot;path&quot;: &quot;/location/1864&quot;</b></i></=
div><div><i><b>}</b></i></div></div><div><br></div><div><br></div><div>I ha=
ve been pounding my head against the wall now for a while without any idea =
what to do. Any help would be appreciated.</div><div><br></div><div>Thanks<=
br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr" class=3D"gmail_sign=
ature"><div dir=3D"ltr"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top=
:0pt;margin-bottom:0pt"><span style=3D"font-size:9.5pt;font-family:Verdana;=
color:rgb(68,68,68);background-color:rgb(255,255,255);font-weight:700;font-=
style:normal;font-variant:normal;text-decoration:none;vertical-align:baseli=
ne">Michael D. Barnes<br></span></p><p dir=3D"ltr" style=3D"line-height:1.3=
8;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:9.5pt;font-fam=
ily:Verdana;color:rgb(68,68,68);background-color:transparent;font-weight:40=
0;font-style:normal;font-variant:normal;text-decoration:none;vertical-align=
:baseline">Sr Software Engineer<br></span></p><p dir=3D"ltr" style=3D"line-=
height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:9.5p=
t;font-family:Verdana;color:rgb(68,68,68);background-color:transparent;font=
-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vert=
ical-align:baseline"><img src=3D"https://lh4.googleusercontent.com/Sp9xnvep=
xJBESkxLRN40IGyXFPHgUMicv8nVNkx8viNjvY7U7ITrO50HyJSkzL-8Z1WjvjTrBm2sS6f-aiJ=
w4Yh5EYTYJW3Cn41oKj5tYSERDj2Valjzuffry1aNsBvjbIdCC4c4" style=3D"border: non=
e;" width=3D"146" height=3D"35"></span></p><p dir=3D"ltr" style=3D"line-hei=
ght:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:9.5pt;f=
ont-family:Verdana;color:rgb(68,68,68);background-color:transparent;font-we=
ight:400;font-style:normal;font-variant:normal;text-decoration:none;vertica=
l-align:baseline">Office: +1 404-960-9621<br></span></p><p dir=3D"ltr" styl=
e=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font=
-size:9.5pt;font-family:Verdana;color:rgb(68,68,68);background-color:transp=
arent;font-weight:400;font-style:normal;font-variant:normal;text-decoration=
:none;vertical-align:baseline">E-mail: </span><span style=3D"font-size:9.5p=
t;font-family:Verdana;color:rgb(17,85,204);background-color:transparent;fon=
t-weight:400;font-style:normal;font-variant:normal;text-decoration:none;ver=
tical-align:baseline"><a href=3D"mailto:mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]" target=3D=
"_blank">mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]</a></span></p><p dir=3D"ltr" style=3D"lin=
e-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:9.=
5pt;font-family:Verdana;color:rgb(68,68,68);background-color:transparent;fo=
nt-weight:400;font-style:normal;font-variant:normal;text-decoration:none;ve=
rtical-align:baseline">Web: </span><a href=3D"http://www.site1001.com/" sty=
le=3D"text-decoration:none" target=3D"_blank"><span style=3D"font-size:9.5p=
t;font-family:Verdana;color:rgb(17,85,204);background-color:transparent;fon=
t-weight:400;font-style:normal;font-variant:normal;text-decoration:underlin=
e;vertical-align:baseline">www.site1001.com</span></a></p><br><p dir=3D"ltr=
" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:10pt;font-family:Arial;color:rgb(34,34,34);background-color:t=
ransparent;font-weight:700;font-style:normal;font-variant:normal;text-decor=
ation:none;vertical-align:baseline">Follow Site 1001 on: </span><a href=3D"=
https://linkedin.com/company/site1001" style=3D"text-decoration:none" targe=
t=3D"_blank"><span style=3D"font-size:10pt;font-family:Arial;color:rgb(17,8=
5,204);background-color:transparent;font-weight:700;font-style:normal;font-=
variant:normal;text-decoration:underline;vertical-align:baseline">LinkedIn<=
/span></a><span style=3D"font-size:10pt;font-family:Arial;color:rgb(34,34,3=
4);background-color:transparent;font-weight:700;font-style:normal;font-vari=
ant:normal;text-decoration:none;vertical-align:baseline"> | </span><a href=
=3D"http://instagram.com/site1001" style=3D"text-decoration:none" target=3D=
"_blank"><span style=3D"font-size:10pt;font-family:Arial;color:rgb(17,85,20=
4);background-color:transparent;font-weight:700;font-style:normal;font-vari=
ant:normal;text-decoration:underline;vertical-align:baseline">Instagram</sp=
an></a><span style=3D"font-size:10pt;font-family:Arial;color:rgb(34,34,34);=
background-color:transparent;font-weight:700;font-style:normal;font-variant=
:normal;text-decoration:none;vertical-align:baseline"> | </span><a href=3D"=
https://twitter.com/site1001" style=3D"text-decoration:none" target=3D"_bla=
nk"><span style=3D"font-size:10pt;font-family:Arial;color:rgb(17,85,204);ba=
ckground-color:transparent;font-weight:700;font-style:normal;font-variant:n=
ormal;text-decoration:underline;vertical-align:baseline">Twitter</span></a>=
<span style=3D"font-size:10pt;font-family:Arial;color:rgb(34,34,34);backgro=
und-color:transparent;font-weight:700;font-style:normal;font-variant:normal=
;text-decoration:none;vertical-align:baseline"> | </span><a href=3D"http://=
www.facebook.com/site1001" style=3D"text-decoration:none" target=3D"_blank"=
><span style=3D"font-size:10pt;font-family:Arial;color:rgb(17,85,204);backg=
round-color:transparent;font-weight:700;font-style:normal;font-variant:norm=
al;text-decoration:underline;vertical-align:baseline">Facebook</span></a><s=
pan style=3D"font-size:10pt;font-family:Arial;color:rgb(34,34,34);backgroun=
d-color:transparent;font-weight:700;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> | </span><a href=3D"https://w=
ww.youtube.com/channel/UCmQBqlisUgdd0HjQRVFD6WQ" style=3D"text-decoration:n=
one" target=3D"_blank"><span style=3D"font-size:10pt;font-family:Arial;colo=
r:rgb(17,85,204);background-color:transparent;font-weight:700;font-style:no=
rmal;font-variant:normal;text-decoration:underline;vertical-align:baseline"=
>YouTube</span></a></p><a href=3D"https://www.google.com/maps/place/20772+C=
armen+Loop,+Suite+130+Bend,+OR+97702" style=3D"text-decoration:none" target=
=3D"_blank"><span style=3D"font-size:9pt;font-family:Verdana;color:rgb(17,8=
5,204);background-color:transparent;font-weight:400;font-style:normal;font-=
variant:normal;text-decoration:underline;vertical-align:baseline">20772 Car=
men Loop, Suite 130</span></a><p dir=3D"ltr" style=3D"line-height:1.38;marg=
in-top:0pt;margin-bottom:0pt"><a href=3D"https://www.google.com/maps/place/=
20772+Carmen+Loop,+Suite+130+Bend,+OR+97702" style=3D"text-decoration:none"=
 target=3D"_blank"><span style=3D"font-size:9pt;font-family:Verdana;color:r=
gb(17,85,204);background-color:transparent;font-weight:400;font-style:norma=
l;font-variant:normal;text-decoration:underline;vertical-align:baseline">Be=
nd, OR 97702</span></a></p></div></div></div></div></div>

--00000000000027d04a057d502207--

--===============1353777416151909042==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYWp1Zy1tZW1i
ZXJzIG1haWxpbmcgbGlzdAphanVnLW1lbWJlcnNAbGlzdHMuYWp1Zy5vcmcKTWFuYWdlIHlvdXIg
c3Vic2NyaXB0aW9uIGFuZCB1bnN1YnNjcmliZSBodHRwOi8vbGlzdHMuYWp1Zy5vcmcvbWFpbG1h
bi9saXN0aW5mby9hanVnLW1lbWJlcnM=

--===============1353777416151909042==--