Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » The question about using fetchgraph(The question about using fetchgraph)
The question about using fetchgraph [message #1731549] Fri, 06 May 2016 17:10 Go to next message
Pavel No is currently offline Pavel NoFriend
Messages: 47
Registered: May 2016
I have the following entity:
@Table(name = "tbl1")
public class PersonItem implements Serializable{
    private String guid;
    private String name;
    private String surname;
    private Date birthDate;
   //+getters and setters

And I want that only three fields of 4 were loaded from DB. So I do:
Query query = em.createQuery("Select p from PersonItem p");
EntityGraph<PersonItem> eg = em.createEntityGraph(PersonItem.class);
query.setHint("javax.persistence.fetchgraph", eg);
 List<PersonItem> list=query.getResultList();

Everything works ok and I see in log that only 3 columns are selected. However, when I try to do item.getBirthDate then istead of null or exception the execution of the thread totally stops, so the next statement after item.getBirthDate is not executed. Why, and how can it be fixed?

[Updated on: Fri, 06 May 2016 17:48]

Report message to a moderator

Re: The question about using fetchgraph [message #1731750 is a reply to message #1731549] Mon, 09 May 2016 19:10 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1379
Registered: July 2009
Senior Member
Execution should not be stopping or you have a JVM bug/issue. When accessing an unfetched attribute, EclipseLink will attempt to fetch it from the context, so my guess is you are getting an exception that is unhandled or caught and ignored somewhere in your stack, but if this isn't the case (wrap it in a try/catch block for a Throwable), try posting the jvm and how you are starting the application/thread.
Previous Topic:[moxy] Marshalling empty collection as absent elements for XML
Next Topic:LIMIT query not framed correctly when using CompositePU
Goto Forum:

Current Time: Thu Feb 25 02:41:23 GMT 2021

Powered by FUDForum. Page generated in 0.01633 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top