Changed database data is not shown in the Primefaces Datatable

Asked

Viewed 228 times

5

I am trying to disable JPA cache (Eclipselink 2.5.2) through "persistence.xml", but it is not working.

Changes made to the tables, externally to the application, are not presented in the Primefaces Datatable 5.0 with JSF 2.2.

Environment: Netbeans 8.0.2 + Glassfish 4.1 (with Connection Pool)

What may be missing?

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="br.com.empresa_Teste_war_1.0-SNAPSHOTPU" transaction-type="JTA">
    <jta-data-source>jdbc/teste</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <property name="eclipselink.cache.shared.default" value="false"/>
        <property name="eclipselink.query-results-cache" value="false"/>
        <property name="eclipselink.refresh" value="true"/>
    </properties>
  </persistence-unit>
</persistence>
  • 1

    Welcome to [en.so]! The problem cannot be in your Managed Beans, that is storing the list, without fetching it in the database when the screen is updated? What is the scope of the MB? How is the list getter implemented?

  • Thanks for the welcome! In the project I’m testing, the classes were automatically generated by Netbeans. I had already tested the different types of scope, but had not realized that the generator does not create the annotation @ManagedBean in the MB class. Adding this annotation and passing the scope to @ViewScoped worked as I wished.

  • 1

    Great. If you want to put your solution as an answer to your own question, feel free.

1 answer

0


In the project I’m testing, the classes were automatically generated by Netbeans. I had already tested the different types of scope, but had not realized that the generator does not create the annotation @ManagedBean in the MB class. Adding this annotation and passing the scope to @ViewScoped worked as I wished.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.