Yes ! that was it :) I indeed had an embedded Address with all fields empty ^^. Thank you very much to both of you :) !
I owe you at least a beer :) Regards Martin Jonathan Barker wrote: > > Martin, > > I'm a bit confused about what you are trying to accomplish, but maybe I > can > toss out some ideas. > > If you have loaded a User object via Hibernate: > > Scenario 1: embedded Address > If the embedded address is all null / empty fields, then the Address > reference in User will be null. You may want to make sure the Address > field > is set before rendering. I've hit this before and had to set the address > (if null then new) immediately after loading from hibernate. > > Scenario 2: linked Address > The same problem as Scenario 1 will apply, plus you could run into > problems > if the User was loaded in an earlier session trying to follow the old > Address proxy. > > You may also want to look into the ASO documentation - specifically the > section at the bottom for ASO's requiring configuration. You could make > sure your address is non-null there. > http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html > > Also, you can make sure your UserImpl constructor instantiates an empty > Address object. > > Jonathan > > >> -----Original Message----- >> From: Kheldar666 [mailto:[EMAIL PROTECTED] >> Sent: Sunday, February 03, 2008 1:53 PM >> To: users@tapestry.apache.org >> Subject: Re: [T5] ASO, BeanEditor and Interfaces >> >> >> Heu... >> >> I allready have a full Hibernate/Spring instantiation system that works >> perfectly well :-) . >> >> I'm not trying to instanciate a Bean via Tapestry. I try to edit one that >> is >> allready loaded. >> >> The problem for me comes from Tapestry beanEditor that tries -I think- to >> create an empty bean using the interface Address instead of AddressImpl >> when >> it creates is BeanModel. >> >> Maybe be I dont know how to explain my problem clearly enought... Sorry. >> >> Thank you for your help :) >> >> Martin >> >> >> Sven Homburg wrote: >> > >> > i think you missunderstood completely the sense of hibernate entities >> > and IOC serices. >> > >> > in your case i think it makes more sense to let instantiate the enties >> > by a factory class >> > please read http://www.hibernate.org/328.html >> > >> > 2008/2/3, Kheldar666 <[EMAIL PROTECTED]>: >> >> >> >> Well by adding this to my module : >> >> >> >> public static void bind(ServiceBinder binder){ >> >> binder.bind(User.class, UserImpl.class); >> >> binder.bind(Address.class, AddressImpl.class); >> >> } >> >> >> >> I solved the User instanciation problem. But It didn't solve the >> Address >> >> instanciation problem. >> >> >> >> In fact User model have an Address property. I want to user >> BeanEditForm >> >> to >> >> Edit both the User and is Address. This is the component : >> >> >> >> <t:beanEditForm t:object="user"> >> >> <t:parameter name="address"> >> >> <fieldset> >> >> <legend>Address</legend> >> >> <t:beanEditor object="user.address" /> >> >> </fieldset> >> >> </t:parameter> >> >> </t:beanEditForm> >> >> >> >> I set this in the AppModule for my address field can be detected by >> the >> >> BeanEditor : >> >> >> >> public static void >> >> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class<?>, >> String> >> >> configuration) { >> >> configuration.add(Address.class, "address"); >> >> } >> >> >> >> And I stiil have the InstantiationException. If I make direct >> reference >> >> to >> >> the implementation classes that works fine (but I don't want to do it >> >> that >> >> way). >> >> >> >> I tried configuration.add(AddressImpl.class, "address"); but it does >> not >> >> work at all because tapestru can't detect the Address field in User >> bean. >> >> >> >> Any ideas ? >> >> >> >> Regards, >> >> >> >> Martin >> >> >> >> >> >> >> >> >> >> Sven Homburg wrote: >> >> > >> >> > this should help you >> >> > http://wiki.apache.org/tapestry/Tapestry5HowToIocAndHibernate >> >> > >> >> > 2008/2/3, Kheldar666 <[EMAIL PROTECTED]>: >> >> >> >> >> >> Hi Everybody, >> >> >> >> >> >> I was wondering if ASO and BeanEditor can work with Interfaces ? At >> >> the >> >> >> first sight it seems not possible. >> >> >> >> >> >> Let's say I have this Interface and Classes : >> >> >> >> >> >> public interface User { >> >> >> public int getId(); >> >> >> public void setId(int id); >> >> >> public String getName(); >> >> >> public void setName(String name); >> >> >> } >> >> >> >> >> >> public class UserImpl implements User { >> >> >> //An implementation with Hibernate annotation for instance >> >> >> } >> >> >> >> >> >> Everywhere in Tapestry we use Interfaces for the IoC. But if I >> declare >> >> >> somewhere : >> >> >> >> >> >> >> >> >> @ApplicationState >> >> >> private User _user >> >> >> >> >> >> >> >> >> I have an InstanciationException (witch is normal, because Tapestry >> >> have >> >> >> no >> >> >> way to guess that it should instanciate UserImpl and it tries to >> >> >> instanciate >> >> >> an Interface). >> >> >> >> >> >> So my question is : is there a way to tell Tapestry to instanciate >> the >> >> >> right >> >> >> class and not the Interface (may be via contributing to some >> Service >> >> >> configuration or something ) ? Or should I wrote a simple data >> object >> >> >> that >> >> >> can be directly instanciated and some kind of translator that would >> >> >> convert >> >> >> my Data Object into the class used by my internal services ? >> >> >> -- >> >> >> View this message in context: >> >> >> >> >> http://www.nabble.com/-T5--ASO%2C-BeanEditor-and-Interfaces- >> tp15254725p15254725.html >> >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> >> >> >> >> -------------------------------------------------------------------- >> - >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> > >> >> > >> >> > -- >> >> > with regards >> >> > Sven Homburg >> >> > >> >> > >> --------------------------------------------------------------------- >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> > For additional commands, e-mail: [EMAIL PROTECTED] >> >> > >> >> > >> >> > >> >> > ----- >> >> > best regards >> >> > Sven >> >> > >> >> >> >> -- >> >> View this message in context: >> >> http://www.nabble.com/-T5--ASO%2C-BeanEditor-and-Interfaces- >> tp15254725p15255319.html >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> > -- >> > with regards >> > Sven Homburg >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> > ----- >> > best regards >> > Sven >> > >> >> -- >> View this message in context: http://www.nabble.com/-T5--ASO%2C- >> BeanEditor-and-Interfaces-tp15254725p15256687.html >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> 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] > > > -- View this message in context: http://www.nabble.com/-T5--ASO%2C-BeanEditor-and-Interfaces-tp15254725p15259559.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]