-
1. Re: @Factory and @Create for one method
cptnkirk Jun 29, 2006 10:06 PM (in response to bluetrade)A description of the @Create annotation can be found in chapter 10.3 of the documentation.
http://docs.jboss.com/seam/1.0.1.GA/reference/en/html/annotations.html
@Create only works for components that are either JavaBeans or StatefulSessionBeans and is used to denote a method that should be called when a component is created. For example if you had an init() method you wanted called before any other method on your stateful component, annotate that method with @Create.
@Factory is used to annotate a method that creates and returns a Seam component. The value argument to @Factory will be the component's name. @Factory and @Unwrap are a lot alike. Use @Unwrap if you want your "factory" method to live in its own class. Use @Factory if you want that method to live within another component.
Use @Create to specify an init method on a stateful component.
Hope this helps.
-Jim -
2. Re: @Factory and @Create for one method
bluetrade Jun 29, 2006 11:04 PM (in response to bluetrade)thanks,
But I still don't understand how the Datamodel is basically "wiped", if it was initially populated. This doesn't happen if the factory method is also annotated with @Create. The factory method does the find() for the initial population, and when I call the save() method in the same class I add the latest saved entry to the datamodel by datamodel.add(entry). I don't get how this could (again, without the Create) wipe it...
Thanks