Hibernate Shards 3.0.0.Beta2存在的限制

来源 [b]Hibernate Shards docs[/b]

6.1. Incomplete Implementation of Hibernate API
未完整的实现Hibernate API.

In order to speed-up the initial release of Hibernate Shards, some parts of the Hibernate API that we rarely use were left unimplemented. Of course things that we rarely used are probably critical for some applications, so if we've left you out in the cold we apologize. We're committed to getting the rest of the API implemented quickly. For details on which methods were not implemented, please see the Javadoc for ShardedSessionImpl, ShardedCriteriaImpl, and ShardedQueryImpl.

为了加快最初版本的Hibernate Shards发布,一些我们很少使用的部分Hibernate API没有被实现。当然我们很少使用的那些API也许是一些应用程序的关键部分,对此让你造成的冷遇我们表示抱歉。对于未实现的方法的细节,请看ShardedSessionImpl, ShardedCriteriaImpl, and ShardedQueryImpl Javadoc 文档。

6.2. Cross-Shard Object Graphs
Hibernate Shards does not currently support cross-shard object graphs.

In other words, it is illegal to create an association between objects A and B when A and B live on different shards.

Hibernate will consider the "bad" object in the list to be a new object and, assuming you have cascades enabled for this relationship, it will create a new version of this object on a different shard. This is trouble. In order to help prevent this sort of thing from happening we have an interceptor called CrossShardRelationshipDetectingInterceptor that checks for cross-shard relationships on every object that is created or saved.
Unfortunately there is a cost associated with using the CrossShardRelationshipDetectingInterceptor. In order to determine the shard on which an associated object resides we need to fetch the object from the database, so if you have lazy-loaded associations the interceptor will resolve those associations as part of its checks. This is potentially quite expensive, and may not be suitable for a production system. With this in mind, we've made it easy to configure whether or not this check is performed via the "hibernate.shard.enable_cross_shard_relationship_checks" property we referenced in the chapter on configuration. If this property is set to "true" a CrossShardRelationshipDetectingInterceptor will be registered with every ShardedSession that is established. Don't worry, you can still register your own interceptor as well. Our expectation is that most applications will have this check enabled in their dev and qa environments and disabled in their staging, load and performance, and production environments.

无法创建跨shard对象图。换句话说就是,如果要创建跨越shards的2个对象A和B的关联,那将是非法的。Hibernate将认为是新对象,假如对这个关系你配置了cascades功能,将自动创建这个对象。这是个问题,为了防止此类问题的发生,我们使用一个拦截器叫CrossShardRelationshipDetectingInterceptor在每个对象创建或保存的时刻来检测这跨shard的关系。

可以通过配置hibernate.shard.enable_cross_shard_relationship_checks参数

6.3. Distributed Transactions
分布式事务
Hibernate Shards does not provide support for distributed transactions within a non-managed environment. If your application requires distributed transactions you need to plug in a transaction management implementation that supports distributed transactions.

Hibernate Shards在一个无管理的环境不能提供分布式事务。如果你的程序需要一个分布式事务,你需要插入一个分布式事务管理实现来支持分布式事务。


6.4. Stateful Interceptors

拦截器

6.5. Objects With Ids That Are Base Types

ID基础类型
we don't support base types. id can be represented by a Serializable (or autoboxed into a Serializable).

6.6. Replicated Data
复制数据

看来Shards还存在不少的问题。至少在一个不断发展的平台(数据关系还不稳定的平台上)还不太合适。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值