Problem deleting with EntityHome
mrauls.mrauls.akimeka.com Dec 25, 2008 12:53 AMI am having some difficulties with deleting items using EntityHome. If someone can offer some ideas as to what is going on here I would appreciate it. What I am trying to do is pass an id to the entity home (which is happening) and then I expect it to delete that entity (which is not happening).
It seems to call the delete method, and I actually get this message back:
13:35:52,566 INFO [DefaultDeleteEventListener] handling transient entity in delete processing 13:35:52,566 WARN [PermissionManager] no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if permission management is required. 13:35:52,566 INFO [BloodUnitHome] BloodUnitHome.getId, bloodUnitId = 7 13:35:52,583 INFO [BloodUnitHome] BloodUnitHome.remove, response = removed
...but when I check the database nothing is actually deleted
I suspect this is telling me that I am deleting a temporary, transient entity. But I thought that passing the id to home and modifying the getId method automatically indicated to the home that this was an existing object. What am I not understanding/missing about this?
EntityHome:
@Name("bloodUnitHome")
public class BloodUnitHome extends EntityHome<BloodUnit>
{
@RequestParameter
Long bloodUnitId;
@Override
public Object getId()
log.info("BloodUnitHome.getId, bloodUnitId = " + bloodUnitId );
{
if (bloodUnitId == null)
{
return super.getId();
}
else
{
return bloodUnitId;
}
}
...
}
XHTML Page:
...
<rich:dataTable
id="bloodUnitList" var="bloodUnit"
value="#{bloodUnitList.resultList}" sortMode="multi"
rendered="#{not empty bloodUnitList.resultList}" rows="10">
...
<rich:column rendered="#{s:hasPermission('blood.entry', 'delete')}">
<a4j:commandLink id="delete" value="Delete"
action="#{bloodUnitHome.remove}" immediate="true" styleClass="smalltext">
<f:param name="bloodUnitId" value="#{bloodUnit.id}"/>
<a4j:support event="onviewactivated"
reRender="bloodUnitList,messages" />
</a4j:commandLink>
</rich:column>
...
</rich:dataTable>
...