Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Lazy Basics"
m (New page: =Lazy Basics= JPA specifies that lazy loading is a hint to the persistence provider that data should be fetched lazily when it is first accessed, if possible. If you are developing your ...) |
|||
(22 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | =Lazy | + | {{EclipseLink_UserGuide |
+ | |info=y | ||
+ | |toc=n | ||
+ | |eclipselink=y | ||
+ | |eclipselinktype=JPA | ||
+ | |api=y | ||
+ | |apis= | ||
+ | * [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/FetchType.html FetchType]}} | ||
+ | |||
+ | =Lazy Loading= | ||
JPA specifies that lazy loading is a hint to the persistence provider that data should be fetched lazily when it is first accessed, if possible. | JPA specifies that lazy loading is a hint to the persistence provider that data should be fetched lazily when it is first accessed, if possible. | ||
Line 5: | Line 14: | ||
If you are developing your application in a Java EE environment, you only have to set fetch to <tt>javax.persistence.FetchType.LAZY</tt>, and EclipseLink persistence provider will supply all the necessary functionality. | If you are developing your application in a Java EE environment, you only have to set fetch to <tt>javax.persistence.FetchType.LAZY</tt>, and EclipseLink persistence provider will supply all the necessary functionality. | ||
− | When using a | + | When using a one-to-one or many-to-one mapping in a Java SE environment, to configure EclipseLink JPA to perform lazy loading when the <tt>fetch</tt> attribute is set to <tt>FetchType.LAZY</tt>, configure either dynamic or static weaving. |
− | When using a | + | When using a one-to-one or many-to-one mapping in a Java SE environment that does not permit the use of <tt>-javaagent</tt> on the JVM command line, to configure EclipseLink JPA to perform lazy loading when annotation attribute <tt>fetch</tt> is set to <tt>javax.persistence.FetchType.LAZY</tt>, you can use static weaving. |
− | + | ||
− | + | ||
+ | <!-- | ||
For more information, see the following: | For more information, see the following: | ||
* [[#How to Configure Dynamic Weaving for JPA Entities Using the EclipseLink Agent|How to Configure Dynamic Weaving for JPA Entities Using the EclipseLink Agent]] | * [[#How to Configure Dynamic Weaving for JPA Entities Using the EclipseLink Agent|How to Configure Dynamic Weaving for JPA Entities Using the EclipseLink Agent]] | ||
Line 16: | Line 24: | ||
* [[#How to Disable Weaving Using EclipseLink Persistence Unit Properties|How to Disable Weaving Using EclipseLink Persistence Unit Properties]] | * [[#How to Disable Weaving Using EclipseLink Persistence Unit Properties|How to Disable Weaving Using EclipseLink Persistence Unit Properties]] | ||
* [[#What You May Need to Know About Weaving JPA Entities|What You May Need to Know About Weaving JPA Entities]] | * [[#What You May Need to Know About Weaving JPA Entities|What You May Need to Know About Weaving JPA Entities]] | ||
− | + | --> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
{{EclipseLink_JPA | {{EclipseLink_JPA | ||
− | |previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/ | + | |previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Default Conversions and Converters/Convert|@Convert]] |
|next=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Relationship Mappings|Relationship Mappings]] | |next=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Relationship Mappings|Relationship Mappings]] | ||
− | |up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings|Basic Mappings]]}} | + | |up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings|Basic Mappings]] |
+ | |version=2.2.0 DRAFT}} |
Latest revision as of 11:01, 19 December 2012
EclipseLink JPA
EclipseLink | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source |
Key API
Lazy Loading
JPA specifies that lazy loading is a hint to the persistence provider that data should be fetched lazily when it is first accessed, if possible.
If you are developing your application in a Java EE environment, you only have to set fetch to javax.persistence.FetchType.LAZY, and EclipseLink persistence provider will supply all the necessary functionality.
When using a one-to-one or many-to-one mapping in a Java SE environment, to configure EclipseLink JPA to perform lazy loading when the fetch attribute is set to FetchType.LAZY, configure either dynamic or static weaving.
When using a one-to-one or many-to-one mapping in a Java SE environment that does not permit the use of -javaagent on the JVM command line, to configure EclipseLink JPA to perform lazy loading when annotation attribute fetch is set to javax.persistence.FetchType.LAZY, you can use static weaving.