ok i have reverted the repo back to jpa version.  also switched to plume and can confirm it works with plume but not with plus. also sysout before and after shows that the list size is correct. it is just the view that is not updating

On 29/01/2018 14:37, Thomas Andraschko wrote:
Not sure.

You did this withing your JPA example:

@Transactional
public String delete() {
   itemDao.delete(getItem());
    update();


Could you check the the list size after and before the update method was
called?
Maybe there is something wrong with transaction handling.

I assume that you also switched to EclipseLink when you switched to Mojarra
(TomEE Plume)?


2018-01-29 14:28 GMT+01:00 Matthew Broadhead <[email protected]
:
i have updated the project https://github.com/chongma/myFacesJpa and
removed the JPA stuff.  it seems to work correctly without the JPA stuff.
does this mean i should report this over there?


On 26/01/2018 10:38, Thomas Andraschko wrote:

Yep, a small as possible example (without JPA and other not-related stuff)
would be great!

2018-01-26 9:45 GMT+01:00 Matthew Broadhead <
[email protected]>
:

by the way you can run the project like:
mvn package
mvn tomee:start
you need a schema called myfaces accessible by a user myfaces with
password mypassword.

as you say it may have nothing to do with jpa but only to do with setting
the facesmessage to error.  i can try to make a test later


On 25/01/2018 21:23, Matthew Broadhead wrote:

i have created a test project here
https://github.com/chongma/myFacesJpa

but in the process of creating the project i figured out the problem.
if
i have
FacesContext.getCurrentInstance().addMessage(null,
                  new FacesMessage(FacesMessage.SEVERITY_ERROR, "Deleted
item", null));
in my method then MyFaces doesn't update any of the "ui:repeat" type
components

This works fine:
FacesContext.getCurrentInstance().addMessage(null,
                  new FacesMessage(FacesMessage.SEVERITY_INFO, "Deleted
item", null));

i don't know if this is supposed to be like that but it lost me some
time
trying to figure it out

On 25/01/2018 17:07, Thomas Andraschko wrote:

Yep you are right. Not sure if there is one available.
But it would be great if you could try it without jpa first.

Am Donnerstag, 25. Januar 2018 schrieb Matthew Broadhead :

when i create these mvce projects i always wonder why there isn't a
maven

archetype.  in the case of MyFaces maybe a bare bones project with
jetty-maven-plugin, jpa and jsf all preconfigured ready to create a
sample...

On 25/01/2018 16:28, Thomas Andraschko wrote:

In our JIRA: https://issues.apache.org/jira/projects/MYFACES/issues/

A small maven application with jetty-maven-plugin would be a great
example!

2018-01-25 16:24 GMT+01:00 Matthew Broadhead <
[email protected]

:

ok i will do that.  where do i create an issue?


On 25/01/2018 16:20, Thomas Andraschko wrote:

Could you please provide a mvce and create a issue?

Otherwise it's almost impossible to help you.
2018-01-25 16:14 GMT+01:00 Matthew Broadhead <
[email protected]

:

hi,
i just posted this question on stack overflow.  but then i tested
switching to mojarra and that solved my problem so i guessed i
would
report
it to this list

Consider the following xhtml fragment:

<h:form>
<h:outputText value="#{myBean.items.size()}" />
<ui:repeat var="item" value="#{myBean.items}">
         <div>
             <h:outputText value="#{item.id} #{item.name}" />
             <h:commandButton value="delete"
action="#{myBean.delete}">
                 <f:setPropertyActionListener
target="#{myBean.item}"
value="#{item}" />
                 <f:ajax render="@form" />
             </h:commandButton>
         </div>
</ui:repeat>
<c:forEach var="item" items="#{myBean.items}">
         <div>
             <h:outputText value="#{item.id} #{item.name}" />
         </div>
</c:forEach>
</h:form>
With the backing bean delete method:

@Transactional
public String delete() {
         itemDao.delete(getItem());
         setItems(itemDao.select());
         return null;
}
And the itemDao methods like:

public List<Item> select() {
         CriteriaBuilder cb = em.getCriteriaBuilder();
         CriteriaQuery<Item> cq = cb.createQuery(Item.class);
         Root<Item> item = cq.from(Item.class);
         cq.distinct(true);
         TypedQuery<Item> query = em.createQuery(cq);
         List<Item> itemList = query.getResultList();
         return itemList;
}
public void delete(Project project) {
         project = find(project.getProjectId());
         em.remove(project);
}
The problem is that after the delete button is clicked the count
is
correct, the c:forEach is correct, but the ui:repeat is not
updated
and
still shows the deleted element. Can someone suggest how to force
the
ui:repeat to also refresh?






Reply via email to