• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

missing property FetchType.EAGER in entityManger.find ?

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does JPA2 has any method something like:



So I do not need to set up all my relationships within Users-class to fetchtype.eager.



 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Its usually the exception rather than the rule to define collections to be eagerly fetched, this is because it is easy to override fetching behaviour in a specific query, but the performance overhead of always bringing back a whole object graph is not usually desirable (though this may be different in your case).

Its easy enough to write a method to do what you want though. Your DAO class could create a query by id as required which would be what I'd recommend.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I can create a query for that.

However, it would be nice to have such a feature to find-Method. Maybe in jpa3..;)

thanks.
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JPA does not, but some providers do.

With JPA you could use a JPQL query that uses join fetch to make relationships fetched.

With EclipseLink you can use a LoadGroup or FetchGroup with a query through a query hint that defines what you wish to be loaded.
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic