Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2008 数据库更改未反映在JSF2Web应用程序中_Sql Server 2008_Jsf 2_Intellij Idea_Tomcat7 - Fatal编程技术网

Sql server 2008 数据库更改未反映在JSF2Web应用程序中

Sql server 2008 数据库更改未反映在JSF2Web应用程序中,sql-server-2008,jsf-2,intellij-idea,tomcat7,Sql Server 2008,Jsf 2,Intellij Idea,Tomcat7,当我直接在数据库(SQL Server)中进行更改时,比如在表中添加新行,这些更改不会反映在我的web应用程序中(尝试刷新浏览器),直到我再次运行我的应用程序(在intellij和tomcat插件中) 如果我从我的应用程序中添加一行,我可以在我的数据库管理员中间看到它,但另一种方法不起作用 这是我的persistence.xml文件: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns=

当我直接在数据库(SQL Server)中进行更改时,比如在表中添加新行,这些更改不会反映在我的web应用程序中(尝试刷新浏览器),直到我再次运行我的应用程序(在intellij和tomcat插件中)

如果我从我的应用程序中添加一行,我可以在我的数据库管理员中间看到它,但另一种方法不起作用

这是我的persistence.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="Frutemu" transaction-type="RESOURCE_LOCAL">
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>openjpa</jta-data-source>
        <class>model2.AnalisisProcesosEntity</class>
        <class>model2.AnalisisProcesosDetalleEntity</class>
        <class>model2.AnalisisProcesosPesosEntity</class>
        <class>model2.AnalisisRecepcionesEntity</class>
        <class>model2.AnalisisRecepcionesDetallesEntity</class>
        <class>model2.CalibresEntity</class>
        <class>model2.CalidadDefectosEntity</class>
        <class>model2.CalidadesEntity</class>
        <class>model2.CamarasEntity</class>
        <class>model2.DespachosEntity</class>
        <class>model2.DespachosDetalleEntity</class>
        <class>model2.EspeciesEntity</class>
        <class>model2.ExportadorasEntity</class>
        <class>model2.InspeccionesEntity</class>
        <class>model2.InspeccionesDespachosEntity</class>
        <class>model2.InspeccionesDespachosDetalleEntity</class>
        <class>model2.InspeccionesDetalleEntity</class>
        <class>model2.InspeccionesPalletsEntity</class>
        <class>model2.InspeccionesPalletsDetalleEntity</class>
        <class>model2.InspeccionesResultadoEntity</class>
        <class>model2.PalletsEntity</class>
        <class>model2.PalletsDetalleEntity</class>
        <class>model2.PlantasEntity</class>
        <class>model2.PlantasEmbalajeEntity</class>
        <class>model2.ProcesosEntity</class>
        <class>model2.ProcesosDetalleEntity</class>
        <class>model2.ProductoresEntity</class>
        <class>model2.ProductoresExportadorasEntity</class>
        <class>model2.RecepcionesEntity</class>
        <class>model2.RecepcionesDetalleEntity</class>
        <class>model2.SysdiagramsEntity</class>
        <class>model2.TemporadasEntity</class>
        <class>model2.TiposEmbalajeEntity</class>
        <class>model2.TiposProductoEntity</class>
        <class>model2.UsuariosEntity</class>
        <class>model2.VariedadesEntity</class>
        <class>model2.VistaProcesosEntity</class>
        <class>model2.VistaRecepcionesEntity</class>

        <properties>

            <property name="openjpa.ConnectionDriverName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <property name="openjpa.ConnectionURL" value="jdbc:sqlserver://localhost:55334;databaseName=Frutemu;integratedSecurity=true"/>
            <property name="openjpa.ConnectionUserName" value=""/>
            <property name="openjpa.ConnectionPassword" value=""/>

            <property name="openjpa.jdbc.SynchronizeMappings"
                      value="buildSchema(SchemaAction='add,OpenJPATables=true',ForeignKeys=true)"/>
            <!--property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add,OpenJPATables=true',ForeignKeys=true)"/-->
            <property name="openjpa.DynamicEnhancementAgent" value="true"/>
            <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=ERROR"/>
            <property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000"/>
            <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.MySQLDictionary"/>
            <property name="openjpa.DataCache" value="true"/>
            <property name="openjpa.QueryCache" value="true"/>


        </properties>
    </persistence-unit>
</persistence>

org.apache.openjpa.persistence.PersistenceProviderImpl
openjpa
模型2.分析过程感知
模型2.分析过程安装
模型2.分析过程感知
模型2.分析概念实体
模型2.分析感受性
模型2.口径感知
模型2.校准缺陷实体
模型2.CalidadesEntity
模型2.3
模型2.DespachosEntity
model2.DespachosDetalleEntity
模型2.2特殊实体
模型2.1出口实体
模式2.特殊性
模型2.特殊性
模型2.InspeccionesDespachosDetalleEntity
模型2.INSPECCONESDETALLEENTITY
模型2.特殊性
模型2.InspeccionesPalletsDetalleEntity
模型2.InspeccionesResultadoEntity
模型2.托盘实体
model2.PalletsDetalleEntity
模式2.植物性
模型2.植物界
模型2.procesentity
模型2.PROCESSDETALLEENTITY
模型2.1产品感知
型号2.ProductoresExportadorasEntity
模型2.Recepcionentity
模型2.RecepcionesDetalleEntity
model2.sysdiagramentity
模型2.暂时性
模型2.TiposEmbalajeEntity
模型2.TiposProductoEntity
模式2.2.普遍感知
model2.VariedadesEntity
模型2.vistaprocesential
模型2.Vistarecepcionentity
这是我从中获取要在视图中显示的数据的bean:

@ManagedBean(name = "recepciones")
@ViewScoped
public class RecepcionesBean {

        private List<VistaRecepcionesEntity> recepciones;

        @PostConstruct
        public void init(){
            recepciones=new ArrayList<VistaRecepcionesEntity>();
            recepciones= RecepcionesDAO.getALL();
        }

        public List<VistaRecepcionesEntity> getRecepciones() {
            return recepciones;
        }

        public void setRecepciones(List<VistaRecepcionesEntity> recepciones) {
            this.recepciones = recepciones;
        }


        }
    }
@ManagedBean(name=“recepciones”)
@视域
公共类接收器Bean{
私人名单接收人;
@施工后
公共void init(){
recepciones=newarraylist();
recepciones=RecepcionesDAO.getALL();
}
公共列表GetReceipciones(){
回执;
}
公共无效集合收据(列表收据){
this.recepciones=recepciones;
}
}
}

我不熟悉openJPA。但是选项
openjpa.DataCache
似乎表明您已经为数据激活了缓存。在这种情况下,有几种策略

  • 如果您真的不需要直接“手动”更新数据库,那么就不要这样做。或者停用缓存。这两种方法中的一种可能是最安全的,或者至少是最简单的
  • 否则,您可能需要自定义缓存策略。您可以在X分钟后使缓存失效(并接受这样一个事实,即您的应用程序中可能存在长达X分钟的过时数据)
  • 或者您也可以编写一个页面,允许您手动清除缓存。然后,您可以在每次手动更新数据库时调用它

  • 向我们展示您如何解压缩文件。我的最佳猜测是您需要刷新实体。我添加了bean,从中获取视图的数据。