Re: Hibernate problem with OGNL
2013/3/27 Markus Demetz : > I think I've found the problem. > I had javassist 3.17.1 (latest) in my project but hibernate 4.2 ships with > version 3.15.0 > Now it seems to work! Yeah... this version is buggy :P I have tried update Ognl 3 to it but no luck ;-) Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate problem with OGNL
Hi, I think I've found the problem. I had javassist 3.17.1 (latest) in my project but hibernate 4.2 ships with version 3.15.0 Now it seems to work! Thank you, and sorry for misplacing my question here! Regards, Markus Am 27.03.2013 17:23, schrieb Steve Higham: On 27/03/2013 10:42, Markus Demetz wrote: Hi, I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling . Have you tried or No luck :-( I also tried with JSTL now without success. It's very strange, since sometimes it works and then it reappears again. I'll ask at the hibernate forum. Regards, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org I've seen this behavior on newly created instances. Hibernate doesn't know the ID until the object is persisted to the DB. Hibernate tries to delay this as long as possible to minimise DB writes. You would have thought a request for the ID would force a DB write but Hibernate doesn't seem to implement this behavior. If you want the ID you need to force the DB write first. Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate problem with OGNL
On 27/03/2013 10:42, Markus Demetz wrote: Hi, I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling . Have you tried or No luck :-( I also tried with JSTL now without success. It's very strange, since sometimes it works and then it reappears again. I'll ask at the hibernate forum. Regards, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org I've seen this behavior on newly created instances. Hibernate doesn't know the ID until the object is persisted to the DB. Hibernate tries to delay this as long as possible to minimise DB writes. You would have thought a request for the ID would force a DB write but Hibernate doesn't seem to implement this behavior. If you want the ID you need to force the DB write first. Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate problem with OGNL
Hi, I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling . Have you tried or No luck :-( I also tried with JSTL now without success. It's very strange, since sometimes it works and then it reappears again. I'll ask at the hibernate forum. Regards, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Hibernate problem with OGNL
2013/3/26 Markus Demetz : > Hi, > > I don't know if this is the right place to ask, but maybe there is anyone > who has experienced the same problem. > > I'm using Struts2 (latest version), with Hibernate (latest version) > My database models all have getId(). > > I have situations, where the getId() method of my model class returns null > when navigating through OGNL e.g. when > calling . Have you tried or > When I call getId() from the method in my action class (e.g. UserListAction > iterating though users and calling user.getGallery().getId()), it returns > the id as expected. > If I do that first in my action class, then also my renders > the id as expected; so I thought about a lazy loading issue... all my > getId() methods are public, NOT final, and the Long id members are > protected. > > I also tried to add a getMyId() method in the model which calls getId() from > within the same class. > getMyId() { return getId(); } > > This surprisingly works and outputs the correct id when calling value="#user.gallery.myId"/> You know, HHH uses all that magic with proxies, baytecode manipulation and so ;-) Regards Ł - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Hibernate problem with OGNL
Hi, I don't know if this is the right place to ask, but maybe there is anyone who has experienced the same problem. I'm using Struts2 (latest version), with Hibernate (latest version) My database models all have getId(). I have situations, where the getId() method of my model class returns null when navigating through OGNL e.g. when calling . When I call getId() from the method in my action class (e.g. UserListAction iterating though users and calling user.getGallery().getId()), it returns the id as expected. If I do that first in my action class, then also my renders the id as expected; so I thought about a lazy loading issue... all my getId() methods are public, NOT final, and the Long id members are protected. I also tried to add a getMyId() method in the model which calls getId() from within the same class. getMyId() { return getId(); } This surprisingly works and outputs the correct id when calling Did anyone experience something simliar or has any suggestions? OGNL 3.0.6, Hibernate 4.2, Struts 2.3.12 Thanks, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org