[jboss-user] [JBoss Seam] - EntityHome.persist transaction problem?

Phantom do-not-reply at jboss.com
Fri May 25 07:01:46 EDT 2007


Good day, 
I have the problem with EntityHome.persist in simplest .xhtml page.


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE html
  |         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  |         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
  |       xmlns:f="http://java.sun.com/jsf/core"
  |       xmlns:h="http://java.sun.com/jsf/html"
  |       xmlns:t="http://myfaces.apache.org/tomahawk" xml:lang="en" lang="en">
  | <head>
  |     <title></title>
  |     <ui:debug hotkey="q"/>
  | </head>
  | <body>
  | <h:form>
  |     <h:inputText title="Title" value="#{messageHome.instance.title}"/><br/>
  |     <h:inputText title="Content" value="#{messageHome.instance.content}"/><br/>
  |     <h:commandButton action="#{messageHome.persist}" />
  | <h:dataTable var="mes" value="#{allmessages.resultList}">
  |     <h:column>
  |         <table>
  |             <tr>
  |                 <td><h:outputText value="#{mes.title}"/></td>
  |                 <td><h:outputText value="#{mes.content}"/></td>
  |             </tr>
  |         </table>
  |     </h:column>
  | </h:dataTable>
  | </h:form>
  | </body>
  | </html>
  | 

I use two components which defined in components.xml:


  | <framework:entity-home name="messageHome" entity-class="org.interlogy.ejb.test.Message"/>
  | 
  |     <framework:entity-query name="allmessages" ejbql="select object(m) from Message m"/>
  | 

Page is a simple guest book. User fill 2 fields and send to the server. Then data pulled to the message entity and persisted to the DB. 

But(!) I can see new data not after sending the form but after the second send of the form. I mean:

1) Title=1. Sending.  The list of messages is empty.
2) Title=2. Sending. The list of messages has only one message with title =1.
3) Title=3. Sending. The list of messages has only 2 messages with title=1 and 2

It may be soo in 2 ways:

1) Firstly query executed and then data persisted.
2) We have some transaction problem. Query do not see already persisted data.

Please, Help Me!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048647#4048647

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048647



More information about the jboss-user mailing list