[JBoss Seam] - Re: HowTo: When going to a page to enter data, pull from db
by CptnKirk
Re EJB3 Entities:
anonymous wrote : Not quite, they are only components if the have @Name (in which case they would be CONVERSATION scoped). The "preferred" way to do this is to use Home objects to manage an Entity, rather than expose it directly with @Name, and uses pages.xml for wiring. We could probably do with an example app built using Seam-gen that does a couple of simple CRUD operations
Yep, it was late, I forgot I overrode the scope on some of my entities. However there are plenty of times where simple CRUD doesn't fit the bill. If you're actually managing an entity, sure, use a Home. However if you're using a form to populate an entity for another purpose, using Seam to populate a scoped entity and hand it off for further processing has advantages. Of course the entity doesn't need to be an EJB 3 entity. Seam does the same for POJOs.
For example I don't think I'd recommend using a Home to populate a search prototype. For search pages, an entity with an event scoped role combined with Hibernate's Criteria API + Example criterion is great.
In general if I'm not doing CRUD I prefer to decouple the entity population and the controller doing the work. Prior to Seam I had to populate #{someController.entity.value1}. Now that I can simply work with #{entity.value1} means I have some additional flexibility.
What would be really great would be to put out a Seam cookbook. About @Unwrap, Pete is right, most people just want a contextual variable to go from void (not there), to initialized, and that's usually the job for @Factory. However the managed component pattern can be useful not just for scafolding and exposing non-Seam services. For an example you could have a managed component observe many events that happen within your system and change the underlying representation as a result of those observations. With the managed component pattern a component can manage these actions itself and because the component is unwrapped on every access, all callers will have a consistent view. This is a much different use than what Factories provide for.
I wasn't sure exactly what the user wanted so figured I'd lay out everything and let him choose.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039566#4039566
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039566
19 years
[JBoss Seam] - Re: Building the correct WARs for Tomcat
by tim_perrett
oh ok cool.
The thing is it keep generating Authenticator.java..... which looks to be a method for loggin in, wont this cause errors ootb?
I have the examples all working both tomcat and JBoss AS now, but i'll be dammed if i can make an seam-gen one work correctly lol
Even with a basic helloworld class it complains there is no table called "Greeter" - why would it need a table to say helloworld? is this some kind of built in default?
|
| package com.timperrett.seam.helloworld;
|
| import java.io.Serializable;
| import javax.persistence.Entity;
| import javax.persistence.GeneratedValue;
| import javax.persistence.Id;
| import org.jboss.seam.annotations.Name;
|
| @Entity
| @Name("greeter")
| public class Greeter implements Serializable {
|
| private static final long serialVersionUID = 1L;
|
| Long id;
|
| String message = "Hello world!";
|
| @Id @GeneratedValue
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
|
| public String getMessage() {
| return message;
| }
|
| public void setMessage(String message) {
| this.message = message;
| }
| }
|
|
|
Cheers, appologies for these dumb questions, im very new to seam!
Tim
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039562#4039562
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039562
19 years