Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
broken-petclinic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
s61200
broken-petclinic
Commits
842f9ac9
Commit
842f9ac9
authored
12 years ago
by
Mic
Browse files
Options
Downloads
Patches
Plain Diff
added comments about OSIV
parent
9591555b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java
+8
-1
8 additions, 1 deletion
...ples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java
with
8 additions
and
1 deletion
src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java
+
8
−
1
View file @
842f9ac9
...
...
@@ -15,6 +15,7 @@
*/
package
org.springframework.samples.petclinic.repository.jpa
;
import
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
;
import
org.springframework.samples.petclinic.model.Owner
;
import
org.springframework.samples.petclinic.repository.OwnerRepository
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -40,7 +41,13 @@ public class JpaOwnerRepositoryImpl implements OwnerRepository {
private
EntityManager
em
;
@Override
/**
* Important: in the current version of this method, we load Owners with all their Pets and Visits while
* we do not need Visits at all and we only need one property from the Pet objects (the 'name' property).
* There are some ways to improve it such as:
* - creating a Ligtweight class (example here: https://community.jboss.org/wiki/LightweightClass)
* - Turning on lazy-loading and using {@link OpenSessionInViewFilter}
*/
@SuppressWarnings
(
"unchecked"
)
public
Collection
<
Owner
>
findByLastName
(
String
lastName
)
{
// using 'join fetch' because a single query should load both owners and pets
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment