Oracle神谕

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  219 随笔 :: 7 文章 :: 94 评论 :: 0 Trackbacks

2005年6月22日 #

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"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<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世界畅谈 阅读(383) | 评论 (0)编辑 收藏

This is a preconfigured jboss 4.0.2 installation that contains jBPM.  
这是一个包含jBPM的预先配置好的jboss4.0.2的安装文件

Deployed components
配置组件:
The jBPM service archive: The deploy directory contains a service archive that creates a JbpmSessionFactory at startup of the server and puts it in JNDI. To make use of this JbpmSessionFactory, you have to specify the property jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory in your jBPM configuration (e.g. in the jbpm.properties in your WEB-INF/classes in your web application).
这个jBPM 服务存档:这个部署目录包含一个服务归档,它创建一个JbpmSessionFactory 在服务器启动并且把它丢到JNDI中。为了使用这个JbpmSessionFactory,你不得不使用指定这个属性 jbpm.session.factory.jndi.name-=java:/jbpm/JbpmSessionFactory 在你的jBPM注册文件(例如在jbpm.properties 在你的web程序中的 WEB-INF/classes 里)

The jBPM database: The server includes a hypersonic database that is preconfigured. with the jBPM database tables. Also an example process is already present in the database. The database can be accessed via a TCP connection to port 1701 with the hsqldb driver.
jBPM数据库:这个服务器包含一个原先配置好的hypersonic 数据库。使用这个jBPM数据库表。也可以使用已经数据库中设置好的.这个数据库可以通过 tcp连接1701端口使用这个hsqldb驱动器。

The jBPM web console application: The jBPM web console application is a simple webapplication that allows access to the jBPM database. Currently the functionality of the webapplication is still limited, but a lot of focus is going to go to the webapplication in the near future for making it easier to manage, maintain and monitor your business processes.
Other customizations
jBPM web控制台程序:这个jBPM web控制台程序是一个简单的web程序,它允许访问jBPM数据库。当前这个web程序的功能仍然是受限制的,但是很多焦点, 在不久的未来打算使它更容易管理、维护和监控你的商业流程。

For reducing download the minimal, default and all server configurations have been removed. Only the jbpm configuration is available. (start with run.bat -c jbpm).

 

For improving startup time, some of the default services have been removed.

posted @ 2005-06-22 14:38 java世界畅谈 阅读(622) | 评论 (0)编辑 收藏

<!--

jbpm.db build script  (jbpm.db 编译脚本)
====================

The jbm.db build script consists of a few major sections(jbpm.db 编译脚本包含一些主要部分):

- general setup (普通安装)
- common tasks   (公用任务)
- database specific tasks (数据库特定任务)

A database specific task calls common tasks with the database name as a parameter
and carries out its duties. (一个数据库特定任务调用公有的任务使用数据库名作为一个参数,并且执行它的职责。)

The main tasks are the database script creation and the database test run.(主要的任务是数据库脚本创建和数据库测试运行)

Following is a explanation of the flow for both. They start off with the same steps.
The explanation with use hsqldb as an example.(下面是一个流程的说明。他们开始使用同样的步骤)

1. "prepare" target compiles all jbpm.3 classes ("prepare" 目标编译所有的jbpm3.classes )
2. "hsqldb.prepare" target calls the "db.prepare" target with the parameter "hsqldb" ("hsqldb.prepare" 目标调用"db.prepare"目标使用"hsqldb"参数)
3. "db.prepare" copies the resources tree from the jbpm.3 project and ()
4. sources the property file hsqldb/hibernate.properties and replaces the
   properties from the main project in the copied hibernate config file with
   properties from the file making it database specific to the test settings using
   "hibernate.replace". This differs per database.
   ("db.prepare"从jbpm.3项目和 hsqldb/hibernate.properties 属性文件复制资源目录,并从在复制的拥有从文件属性的hibernate配置文件中的主项目替换这些属性,使用数据库特定给test 的设置使用"hibernate.replace".这对每个数据库是不同的 。
   )

After this preparation the scripts targets (在这准备脚本目标之后)

5. "hsqldb.scripts" target calls the "db.scripts" target with the hsqldb parameter ("hsqldb.script"目标调用"db.script"目标使用hsqldb 参数)
6. "db.scripts" target creates the scripts files in the build/hsqldb/scripts folder based
   on the db specific hibernate configuration
   ("db.scripts"目标创建脚本文件在db特定hibernate配置文件的build/hsql/scripts/目录 或test目标文件 )
or the the test targets

5. "hsqldb.test" target calls the "db.test" target with the hsqldb parameter ("hsqldb.test" 目标调用"db.test"目标使用hsqldb参数)
6. "db.test" target runs all tests against the hsqldb database and creates a test report
   in build/hsqldb/testresults
   ("db.test"目标运行所有的测试 靠着hsqldb 数据库和测试报告)
-->

posted @ 2005-06-22 11:54 java世界畅谈 阅读(271) | 评论 (0)编辑 收藏