We have migrated our application from JBoss 5.1.0 GA to WildFly 8.2.0, to achieve this we have upgraded our technologies to below versions.
JBoss Seam 2.2.0 to Seam 2.3.1
Hibernate 3.3.0 to 4.0.1
JSF 1.2 to 2.1
We are able to load all the pages and save the data successfully. But we are not able to update the data when we are using EntityHome.
I am using h:commandButton for saving the data
<h:commandButton id="save"
styleClass="button"
value="Save"
action="#{userDetailMgr.doPersist}"
rendered="#{!userDetailHome.managed}"/>
<h:commandButton id="update"
styleClass="button"
value="Save"
action="#{userDetailMgr.doUpdate}"
rendered="#{userDetailHome.managed}"/>
And the userDetailHome is as below
@Name("userDetailHome")
public class UserDetailHome extends
EntityHome<UserDetailHome> {
//Override the isManaged() method to identify the results
@Override
public boolean isManaged() {
System.out.println("Managed Value " + super.isManaged());
return super.isManaged();
}
}
And userDetailMgr is as below
@Name("userDetailMgr")
@Scope(ScopeType.SESSION)
public class UserDetailMgr extends AbstractManager
implements Serializable {
@In
EntityManager entityManager;
public String doUpdate() {
userDetailHome.update();
}
public String doPersist() {
userDetailHome.persist();
}
}
Based on sysout in UserDetailHome isManaged() I observed that while loading the page we are getting the correct value(true) loading the selected date in getInstancc() of EntityHome., Once the page is loaded the value is no more available in EntityHome.
When we tried to update(any operation) data we are not getting the the selected instance which is loaded while page is loading ane it is giving new Instance with primary key as null. Since the selected instance is not available in getInstance() it is treating as a new entry and not updating the existing entry.
The below are the configurations in components.xml
<persistence:managed-persistence-context auto-create="true"
name="entityManager"
persistence-unit-jndi-name="java:/projectEntityManagerFactory" />
In persistence.xml
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/projectEntityManagerFactory" />
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
I am suspecting this issue is due to migrating the seam version.
Please let me know if I am missing anything.
I resolved this issue. Earlier we are using JSF 2.1.29, now I downgraded my JSF to 2.1.7 which is inbuilt provided by Seam 2.3.1.