ITPUB??ì3
ITPUB论坛 » Java企业开发 » JPA中的几个概念


标题: JPA中的几个概念
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 11:56 
Cascade settings are unidirectional. This means that it must be explicitly set on both sides
of a relationship if the same behavior is intended for both situations


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 12:14 
In the Persisting an Entity section, we mentioned that the entity instance is ignored if it is
already persisted. This is true, but the entity manager will still honor the PERSIST cascade in this
situation.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 12:31 
There are really only two
cases where cascading the remove() operation makes sense: one-to-one and one-to-many relationships
where there is a clear parent-child relationship.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 15:06 
Occasionally it may be necessary to clear a persistence context of its managed entities. This is
usually required only for application-managed and extended persistence contexts that are
long-lived and have grown too large in size.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 15:10 
All entity
instances managed by the persistence context become detached with their state left exactly as
it was when the clear() operation was invoked.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 15:28 
That said, a flush of the persistence context could occur at any time if the persistence
provider deems it necessary. An example of this is when a query is about to be executed and it
depends on new or changed entities in the persistence context. Some providers will flush the
persistence context to ensure that the query incorporates all pending changes. A provider
might also flush the persistence context often if it uses an eager-write approach to entity updates.
Most persistence providers defer SQL generation to the last possible moment for performance
reasons, but this is not guaranteed.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 15:48 
Any time a detached object that is the target of the one-to-one or many-to-one
relationship is encountered where the source entity is the owner, the flush will still proceed
because the act of persisting the owning entity does not depend on the target. The owning entity
has the foreign key column and needs to store only the primary key value of the target entity.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 16:34 
There are two views on detachment. On one hand, it is a powerful tool that can be leveraged by
applications in order to work with remote applications or to support access to entity data long
after a transaction has ended. On the other hand, it can be a frustrating problem when the
domain model contains lots of lazy-loading attributes and clients using the detached entities
need to access this information.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 16:35 
• When the transaction that a transaction-scoped persistence context is associated with
commits, all of the entities managed by the persistence context become detached.
• If an application-managed persistence context is closed, all of its managed entities
become detached.
• If a stateful session bean with an extended persistence context is removed, all of its
managed entities become detached.
• If the clear() method of an entity manager is used, it detaches all of the entities in the
persistence context managed by that entity manager.
• When transaction rollback occurs, it causes all entities in all persistence contexts associated
with the transaction to become detached.
• When an entity is serialized, the serialized form of the entity is detached from its
persistence context.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
离线 Sky-Tiger
天王盖地虎


来自 Vancouver
精华贴数 39
个人空间 0
技术积分 157862 (3)
社区积分 45608 (13)
注册日期 2004-2-19
论坛徽章:231
现任管理团队成员ITPUB长老会成员Heart of PUB管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章
会员2006贡献徽章开发板块每日发贴之星2008北京奥运纪念徽章:游泳开发板块每日发贴之星2008北京奥运纪念徽章:跳水开发板块每日发贴之星

发表于 2008-7-6 16:50 
The argument to merge() does not become managed
as a result of the merge. A different managed entity (either a new instance or an existing managed
version already in the persistence context) is updated to match the argument, and then this
instance is returned from the merge() method.


__________________
-----孰能浊以静之徐清  孰能安以动之徐生-----  
-----风来疏竹  风过而竹不留声;雁照寒塘  雁去而塘不留影; 故君子事来而心始现  事去而心随空----

----------------
Groovy 研究中...
JAX-WS20(finished)/CXF/ESB/BPEL 研究中...
EJB3(finished)/Hibernate3 研究中...
OSGI/KnopflerFish 研究中...
JBOSS Seam2.0/JSF/AJAX(finished)/ICEFace/ZKoss/Flex3 研究中...
Mysql 研究中...
Spring2.5  研究中...
Blog/Wiki/RSS/ATOM 研究中...
只看该作者    顶部
相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问