[JBoss Seam] - Re: Get Request problems with Seam 2 CR1
by smithbstl
Ok, let me bump this with a rephrased question.
What is the proper way to output a GET link when a page is called via a pageflow?
<pageflow-definition name="serviceRequestCreation>
| ...
|
| <page name="serviceRequestListing" view-id="/addressrequestlisting.xhtml"
| back="enabled">
| <transition name="viewServiceRequest" to="serviceRequest">
| <action expression="#{addressLocator.selectServiceRequest}"/>
| </transition>
| </page>
|
| <page name="serviceRequest" view-id="/servicerequest.xhtml"
| back="enabled">
| <redirect/>
| </page>
| ....
| </pageflow-definition>
|
<page view-id="/servicerequest.xhtml">
| <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
| converterId="javax.faces.Long"/>
| <begin-conversation join="true" pageflow="serviceRequestCreation"/>
| <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
| </page>
What am I missing?
Using an s:link to call "viewServiceRequest" does allow the request parameter to propagate across the redirect. If I don't use a redirect then the link points to the calling page which is not what I want either.
When pasting the link into the browser from outside of the pageflow, it works as expected.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087427#4087427
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087427
18 years, 7 months
[JBoss Seam] - Re: form controls with the same property name
by schmod54
My initial attempt was to do as you said... but it didn't work. I've played around with it and discovered that displaying faces messages attached to a control inside of a loop is problematic. Has anyone done this? The following is my code to allow users to modify a set of "Category" objects:
<a4j:repeat value="#{batchCategories}" var="cat">
| <ui:param name="i" value="#{batchCategories.rowIndex}"/>
| <s:decorate id="name#{i}Decorate" template="/inc/Field.xhtml">
| <ui:define name="label">Name:</ui:define>
| <h:inputText id="name#{i}" value="#{cat.name}"/>
| </s:decorate>
| </a4j:repeat>
Instead of getting my form error messages displayed attached to the proper controls, I get:
WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
in my logs. My decorator is fine, and works if I hardwire it to a particular item, like so:
<ui:param name="cat" value="#{batchCategories.rowData}"/>
| <ui:param name="i" value="#{batchCategories.rowIndex}"/>
| <s:decorate id="name#{i}Decorate" template="/inc/Field.xhtml">
| <ui:define name="label">Name:</ui:define>
| <h:inputText id="name#{i}" value="#{cat.name}"/>
| </s:decorate>
<ui:repeat> has the same behavior, except no warning in the logs. <c:forEach> doesn't display properly either... it puts all the messages in the global area. So... does anyone know how to display faces messages next to particular form controls inside a loop?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087423#4087423
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087423
18 years, 7 months
[Persistence, JBoss/CMP, Hibernate, Database] - How to map @OneToOne with Primary key association
by jfrankman
I have two classes Client and Drivingdistance with a one to one association. The id of the Client is the PK and FK in DrivingDistance. My mapping annotations are as follows:
Client class:
@Table(name="FBCLIENT")
| @Name("client")
| @Scope(ScopeType.SESSION)
| public class ClientVO implements Serializable
| {
| @Id @NotNull @Column(name="CLIENTID")
| public Long getId() {
| return id;
| }
| @OneToOne(cascade = CascadeType.ALL)
| @PrimaryKeyJoinColumn()
| public DrivingDistanceVO getDrivingDistance()
| {
| return drivingDistance;
| }
| ...}
Driving Distance
@Entity
| @Table(name="FBDRVDSTNC")
| @Name("drivingDistance")
| public class DrivingDistanceVO implements Serializable
| {
| @Id @Column(name="CLIENTID")
| @GeneratedValue(generator="foreign")
| @GenericGenerator(name="foreign", strategy = "foreign", parameters={ @Parameter(name="property", value="client") })
| public Long getId() {
| return id;
| }
| @OneToOne(mappedBy="drivingDistance")
| public ClientVO getClient()
| {
| return client;
| }
| }
If I try to assign a driving distance to the client and save it:
ClientVO client=(ClientVO)q.getSingleResult();
|
|
| DrivingDistanceVO vo2=new DrivingDistanceVO();
| //vo2.setId(new Long(225415));
| vo2.setLocation1(new Long(48254));
| vo2.setLocation2(new Long(171767));
| vo2.setUriString("http://www.google.com/intl/en_ALL/images/logo.gif");
| if (client.getDrivingDistance()==null)
| {
| client.setDrivingDistance(vo2);
| em.merge(client);
| }
I get the following error:
javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property: client
| at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:567)
| at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:210)
| at com.idfbins.nexus.business.test.ClientDrivingDistanceTest.testClientDriveDistancePersist(ClientDrivingDistanceTest.java:63)
| Caused by: org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property: client
| at org.hibernate.id.ForeignGenerator.generate(ForeignGenerator.java:44)
| at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)
| at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:165)
| at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:102)
| at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:51)
| at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:679)
| at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:663)
| at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:667)
| at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:201)
| ... 22 more
| ... Removed 21 stack frames
I have poured over the documentation and forums but can't understand why this is failing. I have seen others ask similar questions, but have not found any answers. I have noticed that if I call em.persist instead of em.merge I do not get this error. However, I thought that since the client already exists in the database that merge would be the appropriate method to call.
So, can anyone explain why I am getting the message "org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property: client
" even after I have assigned the driving distance to the client ( client.setDrivingDistance(vo2);
)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087422#4087422
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087422
18 years, 7 months