0 Replies Latest reply on May 25, 2007 7:01 AM by Eleas

    EntityHome.persist transaction problem?

    Eleas Newbie

      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"
      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:t="http://myfaces.apache.org/tomahawk" xml:lang="en" lang="en">
       <ui:debug hotkey="q"/>
       <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}">
       <td><h:outputText value="#{mes.title}"/></td>
       <td><h:outputText value="#{mes.content}"/></td>

      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!