Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
01. Jun 2008, 07:12 CET | Link

I have strange problem with my application. If I change some value in some input field in view this change is immediately saved to database. But I dont execute no method, I dont send form changes, I am only typing in the fields and changes are persisted to the database immediately. When I look into db after closing application (without saving changes) or after change some field in the DB is new changed value. After every key-press action in the view I have hibernate update command in the console. When I remove a:support tag from input field the update is not processed. But I need a:support because I want to validate field immediately and not all fields after form submitting.

Thanks for some tips..

7 Replies:
01. Jun 2008, 07:21 CET | Link

Here is part of my view

<a:outputPanel id="IPPanel" rendered="#{s:hasRole('admin') and user.role eq 'reseller'}">
  <s:decorate>
    <h:inputText id="IPInput" value="#{user.ip}" styleClass="text">
      <a:support event="onblur" reRender="IPPanel" ajaxSingle="true" />
    </h:inputText>
    <h:message for="IPInput" errorClass="error" />
</s:decorate>
</a:outputPanel>
02. Jun 2008, 12:23 CET | Link

Try using bypassUpdates="true" on <a:support />

 

Read about how to report a bug.

Rating:  * * *
02. Jun 2008, 13:29 CET | Link

Yes, thanks... It solved problem with database update, but It caused another one problem. When I now remove some value from field which is not required and go to another field, the old value from previous field will appear. For example: I have some IP address in IPInput field. I will delete it. I go to antoher field. And old value of IP address will appear in the IPInput field. So I cant now delete fields which are not required, I can only change values.

02. Jun 2008, 15:03 CET | Link

How are you injecting your persistence context? Is it a seam-managed persistence context? Is this is long running conversation? Is user an entity? An ejb session bean? Is it a seam component, and if so, is it annotated with @Transactional?

02. Jun 2008, 16:04 CET | Link

A User is an entity bean. I am not using ejbs. And user is updated via UserHome object.


@Name("userHome")
public class UserHome extends EntityHome<User> {

  @In
  private EntityManager entityManager;

}

I have entityManager defined in my components.xml file as:


<persistence:managed-persistence-context name="entityManager" auto-create="true" entity-manager-factory="#{hcpEntityManagerFactory}"/>
<persistence:entity-manager-factory name="hcpEntityManagerFactory" persistence-unit-name="hcp"/>

and for update I am calling userHome.update() method which is not overrided. So it is marked as @Transactional.

It is not long running converastion.

But old value in field after deletion will appear after leaving this field. I am not calling some of my methods. It is caused with AJAX a:support component.

02. Jun 2008, 17:40 CET | Link

If you haven't begun a long running conversation, your userHome component has been destroyed after rendering the initial repsonse. Thus, on each ajax submission, you are re-creating it, re-loading the entity from the database, and hence your field values aren't living beyond each ajax request/response.

05. Jun 2008, 13:30 CET | Link

I have tried to start long running converastion before rendering view with my form. Conversation starts, I have my userHome object in its context but with no effect. If I clear field, which is not required its old value will appear. Everithing works fine, when I remove a:support tags from page, but all fields are validated after user submit form. I wanted to do validation immediately on blur action on field.