[JBoss Seam] - Re: FlushModeType not working in Seam 1.2.1 GA?
by kotlusa
You were absolutely correct. I didn't catch that the SMPC was actually a Seam Component and need to be retrieved with @In rather than @PersistenceContext.
After making this change I have learned several things and found one that I believe to be a bug.
SMPC's only manage entity beans for the life of the conversation. This is an important distinction between an SMPC and a persistence context obtained with @PersistenceContext(type=PersistenceContextType.EXTENDED).
All this is fine but I still am having difficulty realizing the promise of atomic conversations.
Merge and remove operations both get queued and executed when I flush. Unfortunately, persist operations do not act this way.
I created a sample application with a conversation that begins on a page that lists the users in the database. A nested conversation begins when you edit a user in the list. On the edit page, the user is updated (merge), another entity is delete (remove), and a third entity is created (persist). Clicking Next brings you to a confirmation screen where you can either go back (and do another merge, remove, and persist), Submit (flush, end the conversation, and return to the list), or Cancel (no flush, end the conversation, and return to the list).
In this example, all merges and removes are queued until flush is called (when user clicks Submit on the confirmation screen) but all persists happen right away regardless of submitting/canceling.
What are your thoughts?
Thanks again,
Austin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090063#4090063
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090063
17 years, 2 months
[JBoss Seam] - no action called from a form because of selectOneMenu
by vlaugier
Hello,
we struggle with a very weird problem for a few days now
we have a two step registering process in the application
in the second form the user can specify his roles, his manager, his company from three selectOneMenu
if we remove the company choice part from the form everything works fine
if we add it, or even if we put it all alone on the page the method in the manager bean is not called anymore !! (we have put a println at the beginning to check this) : we press the button, the page reload, that's all
here is the xhtml page :
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf"
| xmlns:c="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| xmlns:ec="http://jboss.com/products/seam/entityconverter/taglib"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
| <h:messages globalOnly="true" styleClass="message"/>
|
|
| <h:form id="createAccount" styleClass="edit">
|
|
|
| <rich:panel>
| <c:facet name="header">Informations complémentaires</c:facet>
|
|
| <div class="input">
| Nom du manager :
| <s:decorate id="managerSelection">
|
| <h:selectOneMenu id="SelectionMenuForManager" value="#{employee.manager}" >
|
| <s:selectItems value="#{employeeQuery.resultList}" var="row" label="#{row.account.fullname}" noSelectionLabel="Please Select..."/>
| <s:convertEntity />
|
| </h:selectOneMenu>
|
| </s:decorate>
| </div>
|
|
| <div class="input">
| <s:decorate id="roleSelection">
| <ui:define name="label">Ajout d'un rôle:</ui:define>
| <h:selectOneMenu id="SelectionMenuForRoles" value="#{role}" >
|
| <s:selectItems value="#{roleQuery.resultList}" var="row" label="#{row.name}" noSelectionLabel="Please Select..."/>
| <s:convertEntity />
|
| </h:selectOneMenu>
| </s:decorate>
|
| <h:commandButton value="Ajouter le rôle"
| action="#{accountManager.registerRole(role)}"/>
| </div>
|
| <div class="input">
| <h:dataTable value="#{account.roles}" var="row" >
| <h:column>
| #{row.name}
| </h:column>
| <h:column>
| <h:commandButton action="#{accountManager.removeRole(row)}" value="Retirer le rôle" />
| </h:column>
| </h:dataTable>
| </div>
|
|
| <div class="input">
| Nom de la société :
| <s:decorate id="companySelection">
|
| <h:selectOneMenu id="SelectionMenuForCompany" value="#{employee.company}" >
|
| <s:selectItems value="#{companyQuery.resultList}" var="row" label="#{row.name}" noSelectionLabel="Please Select..."/>
| <s:convertEntity />
|
| </h:selectOneMenu>
|
| </s:decorate>
| </div>
|
|
|
| <div style="clear:both"/>
|
|
|
| </rich:panel>
|
| <div class="actionButtons">
|
| <h:commandButton value="Enregistrer le compte employé"
| action="saveAccountAction"/>
| </div>
|
| </h:form>
|
| </ui:define>
|
| </ui:composition>
|
this is the manager bean
| package fr.helmet.portal.manager;
|
| import fr.helmet.portal.entity.Account;
| import fr.helmet.portal.entity.Client;
| import fr.helmet.portal.entity.Employee;
| import fr.helmet.portal.entity.Role;
| import java.io.Serializable;
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.PersistenceContextType;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.security.Restrict;
| import org.jboss.seam.core.FacesMessages;
| import org.jboss.seam.log.Log;
|
| @Stateful
| @Name("accountManager")
|
| public class AccountManagerBean implements AccountManager, Serializable {
|
| @Logger private Log log;
|
|
| @In FacesMessages facesMessages;
|
| @PersistenceContext(type=PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| @In(required=false)
| @Out(required=false)
| private Account account ;
|
|
|
| @Out(required=false)
| @In(required=false)
| private Employee employee;
|
|
| @Out(required=false)
| @In(required=false)
| private Client client;
|
|
|
|
|
|
| @Destroy @Remove
| public void destroy() {}
|
|
|
| public Account getAccount() {
| return account;
| }
|
| public void setAccount(Account account) {
| this.account = account;
| }
|
|
| public void registerClient() {
| System.out.println("Entrée dans registerClient");
| Client client = new Client();
| System.out.println("Avant setAccount");
| System.out.println(account.getId() + account.getFullname());
| client.setAccount(account);
| System.out.println("Apres setAccount");
|
| em.persist(client);
| System.out.println("Enregistrement du client réussi !");
|
|
| }
|
|
|
|
| public void registerEmployee() {
|
| System.out.println("IN REGISTERING EMPLOYEE");
|
| Employee employee = new Employee();
|
| employee.setAccount(this.account);
|
| em.persist(employee);
|
| System.out.println("REUSSI !");
| }
|
|
| public void registerRole(Role role)
| {
|
| System.out.println("in registerRole");
| account.getRoles().add(role);
| }
|
| public void removeRole(Role role)
| {
| account.getRoles().remove(role);
| System.out.println("R?le supprim? de la commande");
| }
|
|
| public Employee getEmployee() {
| return employee;
| }
|
| public void setEmployee(Employee employee) {
| this.employee = employee;
| }
|
| @Restrict
| public String editClient(Client selectedClient) {
|
| //Client toEdit = em.merge(selectedClient);
| this.client = selectedClient;
| this.account = this.client.getAccount();
| //this.client = clt;
| //System.out.println("ID du client = " + this.client.getId()) ;
| //System.out.println("editAccount " + this.client.getAccount().getFullname());
| //facesMessages.add("editAccount " + this.client.getAccount().getFullname());
| //this.account = client.getAccount();
| return "createAccount";
| }
|
| public Client getClient() {
| return client;
| }
|
| public void setClient(Client client) {
| this.client = client;
| }
|
| public String testing(String str){
| //facesMessages.add("test !");
| System.out.println("Le message est " + str);
| return "createAccount";
| }
|
| public void updateAccount() {
| System.out.println("mise à jour");
| em.merge(account);
| }
|
| }
|
|
hope it inspires some of you guys
thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090061#4090061
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090061
17 years, 2 months
[JBossWS] - Setting org.jboss.ws.timeout on client
by zebathon
Hello,
I'm trying to set the timeout value on my jax-ws client in Jboss-4.2.1.GA and Jbossws-1.2.1 without success. Any help at all would be much appreciated.
I've tried via jboss-client.xml like so
<jboss-client>
| <jndi-name>jbossws-client</jndi-name>
| <service-ref>
| <service-ref-name>Activity Authorized</service-ref-name>
| <port-component-ref>
| <service-endpoint-interface>com.mycompany.webservices.client.ActivityAuthorizedService</service-endpoint-interface>
| <port-qname>{http://webservices.mycompany.com/}ActivityAuthorized</port-qname>
| <stub-property>
| <name>org.jboss.ws.timeout</name>
| <value>10</value>
| </stub-property>
| </port-component-ref>
| </service-ref>
| </jboss-client>
|
Without luck.
I've also tried programmatically via info from the wiki
| ActivityAuthorized endpoint = service.getActivityAuthorizedPort();
|
| Stub stub = (Stub)endpoint;
| stub._setProperty(StubExt.PROPERTY_CLIENT_TIMEOUT0, "10");
|
But this results in a classcast on the 2nd line.
Here is my generated client service
@WebServiceClient(name = "ActivityAuthorizedService", targetNamespace = "http://webservices.mycompany.com", wsdlLocation = "http://localhost/services-1.0-SNAPSHOT/ActivityAuthorized?wsdl")
| public class ActivityAuthorizedService
| extends Service
| {
|
| private final static URL ACTIVITYAUTHORIZEDSERVICE_WSDL_LOCATION;
|
| static {
| URL url = null;
| try {
| url = new URL("http://localhost/services-1.0-SNAPSHOT/ActivityAuthorized?wsdl");
| } catch (MalformedURLException e) {
| e.printStackTrace();
| }
| ACTIVITYAUTHORIZEDSERVICE_WSDL_LOCATION = url;
| }
|
| public ActivityAuthorizedService(URL wsdlLocation, QName serviceName) {
| super(wsdlLocation, serviceName);
| }
|
| public ActivityAuthorizedService() {
| super(ACTIVITYAUTHORIZEDSERVICE_WSDL_LOCATION, new QName("http://webservices.mycompany.com", "ActivityAuthorizedService"));
| }
|
| /**
| *
| * @return
| * returns ActivityAuthorized
| */
| @WebEndpoint(name = "ActivityAuthorizedPort")
| public ActivityAuthorized getActivityAuthorizedPort() {
| return (ActivityAuthorized)super.getPort(new QName("http://webservices.mycompany.com", "ActivityAuthorizedPort"), ActivityAuthorized.class);
| }@WebServiceClient(name = "ActivityAuthorizedService", targetNamespace = "http://webservices.mycompany.com", wsdlLocation = "http://localhost/services-1.0-SNAPSHOT/ActivityAuthorized?wsdl")
| public class ActivityAuthorizedService
| extends Service
| {
|
| private final static URL ACTIVITYAUTHORIZEDSERVICE_WSDL_LOCATION;
|
| static {
| URL url = null;
| try {
| url = new URL("http://localhost/services-1.0-SNAPSHOT/ActivityAuthorized?wsdl");
| } catch (MalformedURLException e) {
| e.printStackTrace();
| }
| ACTIVITYAUTHORIZEDSERVICE_WSDL_LOCATION = url;
| }
|
| public ActivityAuthorizedService(URL wsdlLocation, QName serviceName) {
| super(wsdlLocation, serviceName);
| }
|
| public ActivityAuthorizedService() {
| super(ACTIVITYAUTHORIZEDSERVICE_WSDL_LOCATION, new QName("http://webservices.mycompany.com", "ActivityAuthorizedService"));
| }
|
| /**
| *
| * @return
| * returns ActivityAuthorized
| */
| @WebEndpoint(name = "ActivityAuthorizedPort")
| public ActivityAuthorized getActivityAuthorizedPort() {
| return (ActivityAuthorized)super.getPort(new QNamwebservicese("http://webservices.mycompany.com", "ActivityAuthorizedPort"), ActivityAuthorized.class);
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090060#4090060
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090060
17 years, 2 months
[JBoss Seam] - Re: Examples for nested data
by robshep
I understand the basic concepts. Data organisation for this project is trivial.
Houses->Rooms->Chairs
"Yacho" wrote : You Can fetch your entity with all referenced data - and display it somehow
No I can't.... hence OP :)
The actual display tree component is irrelavent at this stage. Take for example my model....
House class has a @OneToMany List<Room> rooms in it.
Room has a House house parent reference in it.
hibernate deploys this and generates the tables, with constraints, as i would expect. My first step would be to, for example, show the list of houses with the number of rooms in each. I've seen the boilerplate generated code for displaying normal properties, E.g. #{house.name} but how do i go about displaying house.rooms.size() in JSF/facelet. does any code for this need to go in a session bean? what alterations go in the entity.
as i said i'm a beginner. a simple as possible please.
many thanks
Ro
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090054#4090054
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090054
17 years, 2 months
[JBoss Seam] - Re: Seam Mail send exception from portlet
by jarkko@jab.fi
We got past this one by making a modification in org.apache.myfaces.context.portlet.PortletExternalContextImpl
| public String encodeNamespace(String name) {
|
| // changed by jli @ 29.9.2007 to allow seam email
| // generation in portal environment
| if (_isActionRequest) { // encodeNamespace only allowed for
| // RenderRequest
| return name;
| // String msg = "Can not call encodeNamespace() during a portlet
| // ActionRequest";
| // throw new IllegalStateException(msg);
| }
|
| // we render out the name and then the namespace as
| // e.g. for JSF-ids, it is important to keep the _id prefix
| // to know that id creation has happened automatically
| return name + ((RenderResponse) _portletResponse).getNamespace();
| }
|
We also discovered that you can't use facelet tags (ui: etc) when sending seam email from inside portlet.. So below doesn't work and we had to implement looping outside the template. The bad thing is that also the h: tags don't work..
| <ui:repeat value="#{people}" var="p">
| <m:message>
| <m:from name="#{person.firstname} #{person.lastname}">#{person.address}</m:from>
| <m:to name="#{p.firstname}">#{p.address}</m:to>
| ...
| </m:message>
| </ui:repeat>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090052#4090052
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090052
17 years, 2 months