Re: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
I don't fully understand your problem... Tapestry doesn't create objects for you by default (except ASOs)... Page properties are only holders of values. I'm not sure where you get a second copy of one of your hibernate objects. Also you should not override equals and hashcode! This might just hide some underlying session issues... Hibernate doesn't like having several instances of the same object. Your issue could be related to these methods... At least without them you'll see if there is not a hibernate session issue there. Do you reconnect the hibernate objects before the page rewinds? On 8/21/06, Vinicius Carvalho [EMAIL PROTECTED] wrote: Sorry for the delay. Well, object equals and hashcodes are fully implemented. What solved the problem was setting the property persistent, which I really did no liked :( When using a volatile property, tapestry is overwriting the objects, by fresh new ones, filled only with forms values (as I said, there are some properties that are not displayed for the user but important). When switch to a persistent object (session bound) it preserves the values, changing only the ones that changed This is kinda awkward, I solved using a persistent strategy due the lack of time of the project, but I really would like to check it deeper, as I'd not like to have a lot of objects floating around my session. Best regards On 8/19/06, Ryan Holmes [EMAIL PROTECTED] wrote: Just to clarify, Tapestry does not overwrite bound objects with new instances. iow, if a bound value is a Hibernate proxy, that's what you'll get -- for better or worse ;) -Ryan On Aug 19, 2006, at 7:20 AM, Vinicius Carvalho wrote: Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ryan Holmes, CISSP [EMAIL PROTECTED] ph. (213) 626-0026 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Henri Dupre Actualis Center
Re: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
I find that when things seem awkward in Tapestry it is often because I use the wrong approach. If you find yourself forced to create a session when there is no need for it, you probably need to rethink how you use listeners/triggers on page/component. Vinicius Carvalho [EMAIL PROTECTED] skrev i en meddelelse news:[EMAIL PROTECTED] Sorry for the delay. Well, object equals and hashcodes are fully implemented. What solved the problem was setting the property persistent, which I really did no liked :( When using a volatile property, tapestry is overwriting the objects, by fresh new ones, filled only with forms values (as I said, there are some properties that are not displayed for the user but important). When switch to a persistent object (session bound) it preserves the values, changing only the ones that changed This is kinda awkward, I solved using a persistent strategy due the lack of time of the project, but I really would like to check it deeper, as I'd not like to have a lot of objects floating around my session. Best regards On 8/19/06, Ryan Holmes [EMAIL PROTECTED] wrote: Just to clarify, Tapestry does not overwrite bound objects with new instances. iow, if a bound value is a Hibernate proxy, that's what you'll get -- for better or worse ;) -Ryan On Aug 19, 2006, at 7:20 AM, Vinicius Carvalho wrote: Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ryan Holmes, CISSP [EMAIL PROTECTED] ph. (213) 626-0026 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
Sorry for the delay. Well, object equals and hashcodes are fully implemented. What solved the problem was setting the property persistent, which I really did no liked :( When using a volatile property, tapestry is overwriting the objects, by fresh new ones, filled only with forms values (as I said, there are some properties that are not displayed for the user but important). When switch to a persistent object (session bound) it preserves the values, changing only the ones that changed This is kinda awkward, I solved using a persistent strategy due the lack of time of the project, but I really would like to check it deeper, as I'd not like to have a lot of objects floating around my session. Best regards On 8/19/06, Ryan Holmes [EMAIL PROTECTED] wrote: Just to clarify, Tapestry does not overwrite bound objects with new instances. iow, if a bound value is a Hibernate proxy, that's what you'll get -- for better or worse ;) -Ryan On Aug 19, 2006, at 7:20 AM, Vinicius Carvalho wrote: Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ryan Holmes, CISSP [EMAIL PROTECTED] ph. (213) 626-0026 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
The problem you are facing is due to the nature tapestry works (the rewind-cycle). There is documentation online, you might read it to understand this behaviour and to solve it without a persistent attribute. In short: when the page renders you have your data, when you submit a form rewinding of the exact same form takes place. If your attribute is not persistent it might be gone by now (unless you recreate it from database for example). There are different strategies for solving this problem, RTFM ;-) Cheers, detlef -Original Message- From: Vinicius Carvalho [mailto:[EMAIL PROTECTED] Sent: Montag, 21. August 2006 14:01 To: Tapestry users Subject: Re: Tapestry with Hibernate vs JSF with Hibernate (Object binding question) Sorry for the delay. Well, object equals and hashcodes are fully implemented. What solved the problem was setting the property persistent, which I really did no liked :( When using a volatile property, tapestry is overwriting the objects, by fresh new ones, filled only with forms values (as I said, there are some properties that are not displayed for the user but important). When switch to a persistent object (session bound) it preserves the values, changing only the ones that changed This is kinda awkward, I solved using a persistent strategy due the lack of time of the project, but I really would like to check it deeper, as I'd not like to have a lot of objects floating around my session. Best regards On 8/19/06, Ryan Holmes [EMAIL PROTECTED] wrote: Just to clarify, Tapestry does not overwrite bound objects with new instances. iow, if a bound value is a Hibernate proxy, that's what you'll get -- for better or worse ;) -Ryan On Aug 19, 2006, at 7:20 AM, Vinicius Carvalho wrote: Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ryan Holmes, CISSP [EMAIL PROTECTED] ph. (213) 626-0026 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
I don't fully understand, but it sounds a bit like you have a property on your page which should be marked as persistent but isn't. Could you post some code (java, page, html)? Cheers, Detlef -Original Message- From: Vinicius Carvalho [mailto:[EMAIL PROTECTED] Sent: Samstag, 19. August 2006 16:21 To: Tapestry users Subject: Tapestry with Hibernate vs JSF with Hibernate (Object binding question) Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
Also, not understanding the problem myself, you might want to check that the entites have a useful implementation of equals/hashcode. This sort of thing has bit me more times than I care to remember.. If u test the objects with an equals/hashcode impl based solely on the nullable primary key of the entities, do things change or do better? Peace, Josh On 8/19/06, Detlef Schulze [EMAIL PROTECTED] wrote: I don't fully understand, but it sounds a bit like you have a property on your page which should be marked as persistent but isn't. Could you post some code (java, page, html)? Cheers, Detlef -Original Message- From: Vinicius Carvalho [mailto:[EMAIL PROTECTED] Sent: Samstag, 19. August 2006 16:21 To: Tapestry users Subject: Tapestry with Hibernate vs JSF with Hibernate (Object binding question) Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tapestry with Hibernate vs JSF with Hibernate (Object binding question)
Just to clarify, Tapestry does not overwrite bound objects with new instances. iow, if a bound value is a Hibernate proxy, that's what you'll get -- for better or worse ;) -Ryan On Aug 19, 2006, at 7:20 AM, Vinicius Carvalho wrote: Hello there! As I said on previous emails, I'm migrating a JSF app to tapestry, I'm about to finish. One thing that is really tricking me is the way that the Hibernate entities are bound on both frameworks (I might being doing something wrong here). My edit page has an object (Event) that has a many-to-one relationship to User, so on the same screen I add/edit an user and an event. Well on the JSF, when I hit the service layer (both apps share the same model desing, with same entities and spring transaction managed classes) the Event has an user (that is a EnhancedByCGLIB user) with all it's original values (even those that are not displayed to the user on the screen), so calling: eventDAO.update(event), updates my user as well. On Tapestry side, hitting the service layer, the Event has a User (POJO) and all other values have just gone, it seems that tapestry, when binding it's values it does something like this: User user = new User(); ... //set properties present on the screen, dump all other from database event.setUser(user); This not only mess my database, but also makes hibernate to create a new user for my event, instead of updating an existing one. Well, I'm pretty sure I'm doing stupid things here, could anyone help me out? Best Regards Vinicius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ryan Holmes, CISSP [EMAIL PROTECTED] ph. (213) 626-0026 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]