<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Oracle神諭

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      284 隨筆 :: 9 文章 :: 106 評論 :: 0 Trackbacks

    #

    What is Quartz? (什么是Quartz?)
    Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components or EJBs. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering.

    Quartz 是一個功能齊全的、開源的job時間調度系統,它可以被結合的,或者伴隨虛擬的任何J2EE或J2SE程序-從最小的獨立的應用程序到最大的e-commerce系統被使用。Quartz可以用來創建簡單或復雜的時間調度來執行十、百、千、甚至上萬的jobs;獲得的job被定義為一個標準的java組件或EJBs. 這個Quartz 時間調度包含很多企業類的特征,例如JTA事務和簇。

    The licensing of Quartz versions 1.0 through 1.4.5 is similar to both the BSD and ASF (Apache) public licenses, which means it's free for use, even within commercial products.

    Quartz 1.0版本到1.4.5版本的licensing 是類似與BSD和ASF(apache)公共licenses, 它意味著可以免費使用,甚至使用在商業產品中使用。
    With the upcoming release of version 1.5.0, Quartz is moving to the Apache 2.0 license.
    伴隨1.5.0版本的發布,Quartz將轉移向apache 2.0 的license.

    What can Quartz do for you? (Quartz可以為你做什么?)
    If your application has tasks that need to occur at given moments in time, or if your system has recurring maintenance jobs then Quartz may be your ideal solution.

    如果你的程序有一些這樣的任務,它需要及時地發生在給定時間,或者你如果你的系統有連續維護jobs,那么Quartz可以成為你的理想的解決方案。

    Sample uses of job scheduling with Quartz:
    Quartz使用job時間調度的范例

    Driving Workflow: As a new order is initially placed, schedule a Job to fire in exactly 2 hours, that will check the status of that order, and trigger a warning notification if an order confirmation message has not yet been received for the order, as well as changing the order's status to 'awaiting intervention'.
    System Maintenance: Schedule a job to dump the contents of a database into an XML file every business day (all weekdays except holidays) at 11:30 PM.

    工作流驅動:作為一個新的訂單被初始化放置,調度一個job去工作在正好兩個小時內,它將檢查訂單的狀態,并且觸發一個警告通知如果訂單確認信息沒有被接收,又改變訂單的狀態到"等待干涉"。
    系統維護:調度一個job來將數據庫轉化為XML文件 每商業日期(所有周末除了節假日)在下午11:30。

     

    posted @ 2005-07-20 12:05 java世界暢談 閱讀(815) | 評論 (1)編輯 收藏

    供應鏈已被當成企業成功的關鍵要素,實施供應鏈管理的企業與戰略性供應商分享設計及需求信息,已將觸角延伸至企業之外。供應鏈管理就是利用線形規劃等核心優化技術,對從供應商的供應商、供應商、企業、客戶到客戶的客戶的整個鏈條的管理和優化。
    ......
    供應鏈管理重在兩個部門:供應鏈的計劃和執行。計劃包括倉儲計劃、預測需求計劃、物流的配置計劃、生產計劃、銷售計劃等;供應鏈的執行是以訂單的執行和物流的執行來支撐的。
    ......
    ....協同是提高供應鏈可視性的手段,計劃是供應鏈管理的核心。
    .......
    企業對計劃的重視程度不夠,只重視執行而不重視計劃,往往是導致供應鏈管理系統應用不理想的重要原因。...而自身又不在預測和計劃上下功夫。......計劃恰恰是企業以及供應鏈運作的根本。
     做到有效的供應鏈管理需要企業有效地做到以下三點:1.觀念的轉變和理念上重視,企業必須對供應鏈有足夠的重視,把供應鏈的效率作為企業的核心競爭力之一來抓。2.實施供應鏈管理是企業持續改進、持續優化的進程,而不是項目上線任務就能結束,企業要有持續的動力。3.要有持續的投資、有專門的隊伍,從組織上、人員上給予保障,并且企業要把這些投資看作是提高核心競爭力的必要條件,而不是負擔。這是成功的供應鏈管理基礎。
    ......
    記者:i2的供應鏈管理系統包含哪些功能模塊?

      傅淼:i2供應鏈管理系統的主要功能包括:訂單履行(協同補貨、客戶訂單履行、供應鏈可視性)、供應商尋源與采購(協同供應執行、危險物料管理、產品尋源與重復使用、尋源執行、供應商戰略及績效管理)、供應與需求計劃(協同供應執行、需求管理、工廠解決方案、庫存優化、銷售與運作管理、供應鏈可視性、供應管理)、運輸與配送(補貨計劃、戰略網絡設計與分析、供應商可視性、運輸投標協同、運輸建模與分析、運輸計劃與管理)、內容與數據服務、供應鏈運作服務平臺(業務流程執行、統一基礎設施服務、主數據管理、績效管理)。


    摘選于http://www.topoint.com.cn/zyzx/view.asp?id=5613&cc=0

    posted @ 2005-07-18 09:48 java世界暢談 閱讀(476) | 評論 (0)編輯 收藏

    Using the ProxyFactoryBean to create AOP proxies
    If you're using the Spring Ioc container (an applicationContext or BeanFactory) for you business object--and you should be!-- you will want to use one of Spring's AOP fatoryBeans.(Remeber that a factory bean introduces a layer of indirection, enabling it to create objects of different type).

    The basic way to create an AOP proxy in Spring to use the org.springframework.aop.framework.ProxyFactoryBean. This gives complete control over the pointcuts an advice that will apply, and theire ordering . However ,there are simpler options that are preferable(更可取的、更好的) if you don't need such control.

    Basics
    The proxyFactoryBean,like other Spring FactoryBean implementations,introduces a level of indirection(間接). If you define a ProxyFactoryBean with name foo,what objects referencing foo see is not the ProxyFactoryBean instance itself, but an object created by the ProxyFactoryBeans's implementation of the getObject() method. This method will create an AOP proxy wrapping a target object.

    One of the most important benefits of using a ProxyFactoryBean or other IoC-aware to create AOP proxies, it that it means that advices and pointcuts can also be managed by IoC. This is a powerful feature , enabling certain approaches that are hard to achieve with other AOP frameworks. For example,an advice may itself reference application objects(besides the target , which should be available in any AOP framework),benefiting from all the pluggability provided by Dependency Injection.

    JavaBean properties
    Like most FactoryBean implementations provided with Spring, ProxyfactoryBean is itself a JavaBean. It properties are used to:
    Specify the target you  want to proxy
    Specify whether to use CGLIB

    Some key properties are inherited from org.springframework.aop.framework.ProxyConfig: the subclass for all AOP proxy factories. These include:
    proxyTargetClass: true if we should proxy the target class,rather than its interfaces. If this  is true we need to use CGLIB.

    optimize: whether to apply aggressive optimization to created proxies. Don't use this setting unless you  understand how the relevant(相關的) AOP proxy handles optimization. This is currently used only for CGLIB proxies;it has no effect with  JDK dynamic proxies(the default).

    frozen:whether avice changes should be disallowed once the proxy factory has bean configured. Default is false.

    exposeProxy: whether the current proxy should be exposed in a ThreadLocal so that it can be accessed by the target (It's available via the MethodInvocation without the need for a ThreadLocal) If a target needs to obtain the proxy and exposedProxy is true, the target can use the AopContext.currentProxy() method.

    aopProxyFactory: the implementation of AopProxyFactory to use. Offers a way of customizing whether to use dynammic proxies,CGLIB or any other proxy strategy. The default implementation will choose dynamic proxies or CGLIB appropriately. There should be need to use this property, it's intended to allow the addition of new proxy types in spring 1.1.

    Other properties specific to ProxyFactoryBean include:
    .proxyInterfaces: array of String interface names.  If this isn't supplied, a CGLIB proxy for the target class will be used.
    .interceptorNames:String array of Advisor,interceptor or other advice names to apply.Ordering is sugnicicant. first come,first serve that is. The first interceptor in the list will be the first to be able to interceptor the invocation (of course if it concerns a regular MethodInterceptor or BeforeAdvice. The names are bean names in the current factory , including  bean names from ancestor factories. You  can't mention bean references here since doing so would result iin the ProxyFactoryBean ignoring the singleton  setting of the advise. you can append an iinterceptor name with an asterisk(*).  This will result  in the application of all advisor beans withe names starting with the part before the asterisk to be applied.  An example of using this feature can be found below.

    Singleton: whether or not the factory should return a single object, no matter how often the getObject() method is called. Server FactoryBean implementations offer such a method. Default value is true. If you want to use stateful advice --for example ,for stateful mixins-user prototype advices along withe s singleton value of false.

    Proxying interfaces

    <bean id="personTarget" class="com.mycompany.PersionImpl">
       <property name="name"><value>Tony</value></property>
       <property name="age"><value>51</value></property>  
    </bean>

    <bean id="myAdvisor" class="com.mycompany.MyAdvisor">
       <property name="someProperty"><value>Custom string property value</value></property>
    </bean>

    <bean id="debugInterceptor" class="org.springframework.aop.interceptor.DebugInteceptor" ></bean>

    <bean id="person" class="org.springframework.aop.framework.ProxyFactoryBean">
       <property name="proxyInterface"><value>com.company.Person</value></property>
      
       <property name="target"><ref local="personTarget"/></property>
       <property name="interceptorNames">
          <list>
             <value>myAdvisor</value>
             <value>debugInterceptor</value>
          </list>
       </property>
    </bean>

     

    posted @ 2005-07-07 10:43 java世界暢談 閱讀(473) | 評論 (0)編輯 收藏

           “首先,系統需要骨架,也就是商業模型的設計,沒有這種框架,便會淪為打補丁,久而久之,便縫成了一件丐幫長老的百衲衣。”
      “其二,要有既懂速遞業務,又懂信息化的復合型人才,否則,便會形成外行指揮內行的合作格局,讓不懂IT的速遞從業人員告訴IT人員怎么開發系統,開發什么樣的系統,失敗便是情理之中了。”
      “其三,要能整理需求,更要能提升需求,信息化絕對不是手工操作的簡單復制,要牽扯到流程重組,財務模型設計,人力資源,規范化等各個環節,一句話,要有顧問能力。”
      “其四,適度超前,滿足未來需求而不是眼前需求,這樣才不會被正常的需求變動遷著鼻子走。”
      “其五。。。。。。”
      “其實,最重要的,怎樣定位您的IT系統,”我強調說,“有人把它當成工具,有人把它作為擺設,有人把它作為核心競爭力。。。。。。”
      “核心競爭力?”林夕滿臉狐疑。
      “對,核心競爭力,有人會根據軟件提供的功能流程重新改組組織結構,例如,速遞軟件有一個功能叫主動監控平臺,有家公司據此專門成立了一個監察部,對問題件進行監控預警;還譬如,軟件提供了一個個性化服務平臺,有公司利用這個功能,裁掉了客服部三分之二的人員,服務流程也作了調整,服務質量反而大幅提升了。”

    原文地址:http://www.szmsd.com/20041029.htm
    posted @ 2005-07-06 10:13 java世界暢談 閱讀(150) | 評論 (0)編輯 收藏

     MS SQL有許多默認值是可以修改的,比如:MS SQL默認的用戶連接數是15,一旦使用某數據庫服務器的人多了的時候,特別是一些用戶喜歡打開多個連接的時候,經常造成超過連接數而使一些人連接不上。
    sp_configure語法:sp_configure [_name[,_value]]
    

    ---- 在MS SQL中,以"user connection"標記用戶數目,所以作如下修改:

    ---- 1、以管理員帳號登錄進MS SQL數據庫服務器;

    ---- 2、運行sp_configure系統存儲過程:在Isq_w或Enterprise Manager中的SQL Query Tool中敲入:

    sp_configure "user connections", 150
    go          --如果愿意選比150更大的數字當然可以。
        --最大只能是32767
    RECONFIGURE
    Go
    
    3、執行敲入的SQL語句; 
    4、關閉SQL服務,(在EnterPrise Manger中選中服務器,點右鼠標鍵,選stop,再選start.大功告成! 
    為什么要執行第四步?Sp_configure所帶的參數分兩類,動態與靜態,動態參數不需要重新啟動服務器,運行sp_configure和recnfigure后就改變了,而靜態參數要重新啟動后才能改變。上面的"user connections"就是靜態參數。 
    			
    posted @ 2005-07-01 13:52 java世界暢談 閱讀(929) | 評論 (0)編輯 收藏

    我們使用jtds的SQL Server的驅動替代原來的SQL Server的驅動。后來出現在log中輸出了這樣的信息:
    2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - SQL Warning: 5701, SQLState: 01000
    2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - 已將數據庫上下文改為 'logistics'。
    2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - SQL Warning: 5703, SQLState: 01000
    2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - 已將語言設置改為 簡體中文。
    經過使用Debug級別的log輸出,發現是在
    SQLDiagnostic.java
     /**
         * Create a dianostic SQLException or SQLWarning.
         *
         * @param number SQL Server error number.
         * @param state SQL Server state code.
         * @param serverity SQL Server serverity > 10 = error.
         * @param message SQL Server error message text.
         * @param server SQL Server name.
         * @param procName SQL Server stored procedure name.
         * @param line SQL Server error line number in SQL source.
         */
        void addDiagnostic(int number,
                           int state,
                           int serverity,
                           String message,
                           String server,
                           String procName,
                           int line)
    這里捕獲了 SQL Server error number的,
    后經過MSDN找到如下資料:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_reslsyserr_2_9dtd.asp

    Error 5701

    Severity Level 10
    Message Text

    Changed database context to '%.*ls'.

    Explanation

    This is an informational message indicating that the database context has changed. This message is returned anytime a USE database statement is executed.

    Action

    None needed.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_6_010_34oj.asp

    5701

    Indicates that SQL Server put the user's context into the default database defined in the data source, or into the default database defined for the login ID used in the connection if the data source did not have a default database.

    5703

    Indicates the language being used on the server.

    posted @ 2005-06-30 10:06 java世界暢談 閱讀(966) | 評論 (1)編輯 收藏

    13.7. JasperReports
    JasperReports (http://jasperreports.sourceforge.net) is a powerful, open-source reporting engine that supports the creation of report designs using an easily understood XML file formats. JasperReports is capable of rendering reports output into four different formats: CSV, Excel, HTML and PDF.

    13.7.1. Dependencies (依賴)
    Your application will need to include the latest release of JasperReports, which at the time of writing was 0.6.1. JasperReports itself depends on the following projects:

    BeanShell

    Commons BeanUtils

    Commons Collections

    Commons Digester

    Commons Logging

    iText

    POI

    JasperReports also requires a JAXP compliant(適應的) XML parser.

    13.7.2. Configuration(配置)
    To configure JasperReports views in your ApplicationContext you have to define a ViewResolver to map view names to the appropriate view class depending on which format you want your report rendered in.

    13.7.2.1. Configuring the ViewResolver
    Typically, you will use the ResourceBundleViewResolver to map view names to view classes and files in a properties file

    <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
        <property name="basename">
            <value>views</value>
        </property>
    </bean>
                     
    Here we've configured an instance of ResourceBundleViewResolver which will look for view mappings in the resource bundle with base name views. The exact contents of this file is described in the next section.

    13.7.2.2. Configuring the Views
    Spring contains five different View implementations for JasperReports four of which corresponds to one of the four output formats supported by JasperReports and one that allows for the format to be determined at runtime:

    JasperReport View Class
    1.JasperReportsView           CSV
    2.JasperReportsHtmlView       HTML
    3.JasperReportsPdfView        PDF
    4.JasperReportsXlsView        EXCEL
    5.JasperReportsMutiFormatView

    Mapping one of these classes to a view name and a report file is simply a matter of adding the appropriate entries into the resource bundle configured in the previous section as shown here:

    simpleReport.class=org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView
    simpleReport.url=/WEB-INF/reports/DataSourceReport.jasper
                 
    Here you can see that the view with name, simpleReport, is mapped to the JasperReportsPdfView class. This will cause the output of this report to be rendered in PDF format. The url property of the view is set to the location of the underlying report file.


    13.7.2.3. About Report Files
    JasperReports has two distinct types of report file: the design file, which has a .jrxml extension, and the compiled report file, which has a .jasper extension. Typically, you use the JasperReports Ant task to compile your .jrxml design file into a .jasper file before deploying it into your application. With Spring you can map either of these files to your report file and Spring will take care of compiling the .jrxml file on the fly for you. You should note that after a .jrxml file is compiled by Spring, the compiled report is cached for the life of the application. To make changes to the file you will need to restart your application.

    JasperReports擁有兩種不同的類型的報表文件:設計文件,它是一個擁有.jrxml 擴展的文件,和編譯好的報表文件。一般,你使用ant任務在你部署到你的程序中之前來編譯你的.jrxml設計報表文件。使用Spring 你可以影射這些文件中的任一到你的報表文件,Spring將會為你在空閑時照顧編譯.jrxml文件。 你應當注意在一個.jrxml文件被編譯之后,這個編譯的報表是被緩存的在你的application生命周期中。如果這些文件修改了,你需要重新啟動的你的程序。

    13.7.2.4. Using JasperReportsMultiFormatView  使用JasperReportsMutiFormatView
    The JasperReportsMultiFormatView allows for report format to be specified at runtime. The actual rendering of the report is delegated to one of the other JasperReports view classes - the JasperReportsMultiFormatView class simply adds a wrapper layer that allows for the exact implementation to be specified at runtime.

    JasperReportsMutilFormatView允許你在運行時期指定報表的格式。報表的實際的表現是為委托到JasperReports 視圖類的中的一個--JasperMutilFormatView類簡單的加了一個包裝層允許在運行時期正確的實現被指定。

    The JasperReportsMultiFormatView class introduces two concepts: the format key and the discriminator key. The JasperReportsMultiFormatView class uses the mapping key to lookup the actual view implementation class and uses the format key to lookup up the mapping key. From a coding perspective you add an entry to your model with the formay key as the key and the mapping key as the value, for example:

     

    public ModelAndView handleSimpleReportMulti(HttpServletRequest request,
    HttpServletResponse response) throws Exception {

      String uri = request.getRequestURI();
      String format = uri.substring(uri.lastIndexOf(".") + 1);

      Map model = getModel();
      model.put("format", format);

      return new ModelAndView("simpleReportMulti", model);
    }
    In this example, the mapping key is determined from the extension of the request URI and is added to the model under the default format key: format. If you wish to use a different format key then you can configure this using the formatKey property of the JasperReportsMultiFormatView class.

    By default the following mapping key mappings are configured in JasperReportsMultiFormatView:
    Table 13.3. JasperReportsMultiFormatView Default Mapping Key Mappings

    Mapping Key View Class
    csv   JasperReportsCsvView
    html  JasperReportsHtmlView
    pdf   JasperReportsPdfView
    xls   JasperReportsXlsView

    So in the example above a request to URI /foo/myReport.pdf would be mapped to the JasperReportsPdfView class. You can override the mapping key to view class mappings using the formatMappings property of JasperReportsMultiFormatView.

    posted @ 2005-06-29 10:24 java世界暢談 閱讀(3462) | 評論 (0)編輯 收藏

    SQL Profiler Introduction

    This is a quickly hacked tool to do statistics(統計) on SELECT queries in order to know where it is most efficient to create indexes.  目的是最有效的創建索引.

    This small tool, released under an Apache-based license connects to the P6Spy JDBC logger and displays in real time the queries going to the database. It uses an integrated SQL parser to build statistics on the most accessed tables and columns and can generate SQL index creation files. Other information is also gathered and displayed, such as the request time for a single request, for a class of request, and for all the requests. Sorting may be done on these views to detect(察覺) database problems efficiently.


    This tool can be very useful when you have a big volume of queries that you need to analyze not one by one一個接一個 (meaning that the specific time isn't that much of interest), but rather(若非) when you want to know what "group" of queries is taking a lot of time, such as queries on the same tables and columns but with different query values. The integrated SQL parser (built with ANTLR) is used to analyze the incoming SELECT queries.

    The Swing GUI was based on Apache's Log4J Chainsaw, but all the bugs are mine. Also contributors are welcome to test, make new suggestions, give their opinion and submit patches.

    posted @ 2005-06-28 14:57 java世界暢談 閱讀(382) | 評論 (1)編輯 收藏

    Considerations when choosing a technology (當選擇一個技術時候的考慮)
    Each and every technology presented here has its drawbacks. You should carefully consider you needs, the services your exposing and the objects you'll be sending over the wire when choosing a technology.
    每個技術這里介紹的都有它的缺點。你應該仔細考慮你的需要,當你選擇的時考慮你的暴露的服務和你將要發送關系的對象。


    When using RMI, it's not possible to access the objects through the HTTP protocol, unless you're tunneling the RMI traffic. RMI is a fairly heavy-weight protocol in that it support full-object serialization which is important when using a complex data model that needs serialization over the wire. However, RMI-JRMP is tied to Java clients: It is a Java-to-Java remoting solution.
    當我們使用RMI,我們不可以通過http協議訪問對象,除非你打通RMI交通的隧道。RMI 是一個非常重量級協議,在其中他支持的所有對象的序列化是非常重要的,當使用一個需要序列化關聯的復雜的數據模型。然而,RMI-JRMP 是依賴java客戶端的:它是java-to-java的遠程解決方案。


    Spring's HTTP invoker is a good choice if you need HTTP-based remoting but also rely on Java serialization. It shares the basic infrastructure with RMI invokers, just using HTTP as transport. Note that HTTP invokers are not only limited to Java-to-Java remoting but also to Spring on both the client and server side. (The latter also applies to Spring's RMI invoker for non-RMI interfaces.)
    Spring 的HTTP invoker 是一個不錯的選擇,如果你需要基于HTTP的遠程,而且需要java序列化回復。它使用RMI invoker分享了基礎結構,僅僅使用HTTP作為傳輸。注意HTTP invoker不是僅僅限制給java-to-java的遠程而且是在客戶端和服務器端的Spring.(后面的也應用到Spring 的RMI invoker為非RMI的接口)。

    Hessian and/or Burlap might provide significant value when operating in a heterogeneous environment, because they explicitly allow for non-Java clients. However, non-Java support is still limited. Known problems include the serialization of Hibernate objects in combination with lazily initializing collections. If you have such a data model, consider using RMI or HTTP invokers instead of Hessian.
    Hessian 和或 Burlap可以支持重要的值,當在一個異質的環境操作,因為他們明確的允許為非java 對象。然而非java對象是受限制的,知道的問題包括hibernate對象序列化與懶漢初始化集合的結合上。如果你有這樣的數據模型,考慮使用RMI或HTTP invokers而不是Hessioan.

    JMS can be useful for providing clusters of services and allowing the JMS broker to take care of load balancing, discovery and auto-failover. By default Java serialization is used when using JMS remoting but the JMS provider could use a different mechanism for the wire formatting, such as XStream to allow servers to be implemented in other technologies.


    Last but not least, EJB has an advantage over RMI in that it supports standard role-based authentication and authorization and remote transaction propagation. It is possible to get RMI invokers or HTTP invokers to support security context propagation as well, although this is not provided by core Spring: There are just appropriate hooks for plugging in third-party or custom solutions here.

     

    posted @ 2005-06-24 10:15 java世界暢談 閱讀(663) | 評論 (0)編輯 收藏

    20.2.1. 緩存映射(Cache mappings)

    類或者集合映射的“<cache>元素”可以有下列形式:

    <cache 
        usage="transactional|read-write|nonstrict-read-write|read-only"  (1)
    />
    (1)

    usage說明了緩存的策略: transactionalread-writenonstrict-read-writeread-only

    另外(首選?), 你可以在hibernate.cfg.xml中指定<class-cache><collection-cache> 元素。

    這里的usage 屬性指明了緩存并發策略(cache concurrency strategy)

    20.2.2. 策略:只讀緩存(Strategy: read only)

    如果你的應用程序只需讀取一個持久化類的實例,而無需對其修改, 那么就可以對其進行只讀 緩存。這是最簡單,也是實用性最好的方法。甚至在集群中,它也能完美地運作。

    <class name="eg.Immutable" mutable="false">
        <cache usage="read-only"/>
        ....
    </class>

    20.2.3.  策略:讀/寫緩存(Strategy: read/write)

    如果應用程序需要更新數據,那么使用讀/寫緩存 比較合適。 如果應用程序要求“序列化事務”的隔離級別(serializable transaction isolation level),那么就決不能使用這種緩存策略。 如果在JTA環境中使用緩存,你必須指定hibernate.transaction.manager_lookup_class屬性的值, 通過它,Hibernate才能知道該應用程序中JTA的TransactionManager的具體策略。 在其它環境中,你必須保證在Session.close()、或Session.disconnect()調用前, 整個事務已經結束。 如果你想在集群環境中使用此策略,你必須保證底層的緩存實現支持鎖定(locking)。Hibernate內置的緩存策略并不支持鎖定功能。

    <class name="eg.Cat" .... >
        <cache usage="read-write"/>
        ....
        <set name="kittens" ... >
            <cache usage="read-write"/>
            ....
        </set>
    </class>

    20.2.4.  策略:非嚴格讀/寫緩存(Strategy: nonstrict read/write)

    如果應用程序只偶爾需要更新數據(也就是說,兩個事務同時更新同一記錄的情況很不常見),也不需要十分嚴格的事務隔離, 那么比較適合使用非嚴格讀/寫緩存策略。如果在JTA環境中使用該策略, 你必須為其指定hibernate.transaction.manager_lookup_class屬性的值, 在其它環境中,你必須保證在Session.close()、或Session.disconnect()調用前, 整個事務已經結束

    -------------------------------------------------------------------------
    在jBPM 中使用不少這樣的非嚴格讀/寫緩存的處理:
    <?xml version="1.0"?>

    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "

    <hibernate-mapping default-access="field">

      <class name="org.jbpm.context.def.VariableAccess"
             table="JBPM_VARIABLEACCESS"
             lazy="false">
        <cache usage="nonstrict-read-write"/>
        <id name="id" column="ID_"><generator class="native" /></id>
       
        <property name="variableName" column="VARIABLENAME_" />
        <property name="access" column="ACCESS_" />
        <property name="mappedName" column="MAPPEDNAME_" />
      </class>

    </hibernate-mapping>

    它的ehcache.xml 是這樣配置的:
    <ehcache>
     <defaultCache
            maxElementsInMemory="100000"
            eternal="true"
            overflowToDisk="false"
            diskPersistent="false"
            />
    </ehcache>

    posted @ 2005-06-22 17:32 java世界暢談 閱讀(734) | 評論 (0)編輯 收藏

    僅列出標題
    共29頁: First 上一頁 21 22 23 24 25 26 27 28 29 下一頁 
    主站蜘蛛池模板: 亚洲伊人精品综合在合线| 国产精品亚洲综合一区| 亚洲短视频在线观看| 黄色免费在线网站| 亚洲色精品vr一区二区三区| 好吊色永久免费视频大全 | 免费影院未满十八勿进网站| 亚洲美免无码中文字幕在线| **真实毛片免费观看| 亚洲欧洲国产综合| 亚洲中文无码永久免费| 亚洲一区二区三区在线观看网站| 成人午夜视频免费| 亚洲欧美在线x视频| 成人亚洲网站www在线观看| 国产成人精品免费大全| 国产亚洲精久久久久久无码AV| 亚洲一区二区三区免费| 日本亚洲成高清一区二区三区| 2015日韩永久免费视频播放 | 亚洲成色www久久网站夜月| 四虎国产成人永久精品免费| 亚洲日产2021三区在线| 四虎成人免费网址在线| 一级毛片免费在线观看网站| 久久最新免费视频| 亚洲国产成人久久精品动漫| 免费AA片少妇人AA片直播| 亚洲精品无码你懂的| 亚洲性日韩精品一区二区三区| a级片免费在线观看| 亚洲中文无码线在线观看| 成人性生交视频免费观看| 一道本不卡免费视频| 亚洲高清资源在线观看| 日本免费一本天堂在线| 国精产品一区一区三区免费视频 | 亚洲午夜久久久影院| 亚洲一区二区免费视频| 日本激情猛烈在线看免费观看| 亚洲AV日韩AV高潮无码专区|