You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kheldar666 <ma...@liber-mundi.org> on 2008/02/03 16:52:38 UTC

[T5] ASO, BeanEditor and Interfaces

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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] ASO, BeanEditor and Interfaces

Posted by Sven Homburg <ho...@googlemail.com>.
hmmm, i try to understand,

why do you mean, that the beaneditor should create
or instantiate anything for ?

if i not realy going wrong you must take care that any
class, you want to edit, is instantiated before.
and ofcourse you must feed the beaneditor with an instance
not an interface

2008/2/3, Kheldar666 <ma...@liber-mundi.org>:
>
> 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 <ma...@liber-mundi.org>:
> >>
> >> 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 <ma...@liber-mundi.org>:
> >> >>
> >> >> 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: users-unsubscribe@tapestry.apache.org
> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > with regards
> >> > Sven Homburg
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> >
> >> > -----
> >> > 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: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > --
> > with regards
> > Sven Homburg
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
> > -----
> > 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
with regards
Sven Homburg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: [T5] ASO, BeanEditor and Interfaces

Posted by Jonathan Barker <jo...@gmail.com>.
Martin,

You are very welcome.

Depending on whether there is a difference between an empty embedded object
versus a missing embedded object (is the address missing, or is it blank?),
there is another trick that makes NPE avoidance much easier.

You can add a dummy property (like boolean dummy = false;) to your embedded
object to force Hibernate to instantiate it.  I've done this before for a
UserProfile embedded in a Person object.  It means you have a database
column that serves no real purpose but it also means you never have to worry
about the embedded object being null after Hibernate retrieval.

Jonathan

> -----Original Message-----
> From: Kheldar666 [mailto:martin@liber-mundi.org]
> Sent: Sunday, February 03, 2008 5:49 PM
> To: users@tapestry.apache.org
> Subject: RE: [T5] ASO, BeanEditor and Interfaces
> 
> 
> 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:martin@liber-mundi.org]
> >> 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 <ma...@liber-mundi.org>:
> >> >>
> >> >> 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 <ma...@liber-mundi.org>:
> >> >> >>
> >> >> >> 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: users-unsubscribe@tapestry.apache.org
> >> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > with regards
> >> >> > Sven Homburg
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >> >
> >> >> >
> >> >> >
> >> >> > -----
> >> >> > 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: users-unsubscribe@tapestry.apache.org
> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > with regards
> >> > Sven Homburg
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> >
> >> > -----
> >> > 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: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
> 
> --
> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: [T5] ASO, BeanEditor and Interfaces

Posted by Kheldar666 <ma...@liber-mundi.org>.
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:martin@liber-mundi.org]
>> 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 <ma...@liber-mundi.org>:
>> >>
>> >> 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 <ma...@liber-mundi.org>:
>> >> >>
>> >> >> 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: users-unsubscribe@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > with regards
>> >> > Sven Homburg
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >
>> >> >
>> >> >
>> >> > -----
>> >> > 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: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > with regards
>> > Sven Homburg
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>> > -----
>> > 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: [T5] ASO, BeanEditor and Interfaces

Posted by Jonathan Barker <jo...@gmail.com>.
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:martin@liber-mundi.org]
> 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 <ma...@liber-mundi.org>:
> >>
> >> 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 <ma...@liber-mundi.org>:
> >> >>
> >> >> 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: users-unsubscribe@tapestry.apache.org
> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > with regards
> >> > Sven Homburg
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> >
> >> > -----
> >> > 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: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > --
> > with regards
> > Sven Homburg
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
> > -----
> > 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] ASO, BeanEditor and Interfaces

Posted by Kheldar666 <ma...@liber-mundi.org>.
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 <ma...@liber-mundi.org>:
>>
>> 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 <ma...@liber-mundi.org>:
>> >>
>> >> 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: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > with regards
>> > Sven Homburg
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>> > -----
>> > 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> -- 
> with regards
> Sven Homburg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> -----
> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] ASO, BeanEditor and Interfaces

Posted by Sven Homburg <ho...@googlemail.com>.
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 <ma...@liber-mundi.org>:
>
> 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 <ma...@liber-mundi.org>:
> >>
> >> 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: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > --
> > with regards
> > Sven Homburg
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
> > -----
> > 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
with regards
Sven Homburg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] ASO, BeanEditor and Interfaces

Posted by Kheldar666 <ma...@liber-mundi.org>.
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 <ma...@liber-mundi.org>:
>>
>> 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> -- 
> with regards
> Sven Homburg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> -----
> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] ASO, BeanEditor and Interfaces

Posted by Sven Homburg <ho...@googlemail.com>.
this should help you
http://wiki.apache.org/tapestry/Tapestry5HowToIocAndHibernate

2008/2/3, Kheldar666 <ma...@liber-mundi.org>:
>
> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
with regards
Sven Homburg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org