Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EntityGraph not working in GlassFish
EntityGraph not working in GlassFish [message #1776574] Fri, 17 November 2017 19:57 Go to next message
B  J is currently offline B JFriend
Messages: 1
Registered: November 2017
Junior Member
I would like use Entity Graphs in EclipseLink and GlassFish.

    @Entity
    @NamedQueries({
         @NamedQuery(name = "invoice.all", query = "SELECT i FROM Invoice i")})


    @NamedEntityGraph(name = "graph.invoice",
                attributeNodes = {@NamedAttributeNode("invoiceNum")})

    @Table(name = "INVOICE")
    public class Invoice implements Serializable {
            private int id;
            private String bizonylatSzam;
            ...
        }

EntityManager em = getEntityManagerFactory().createEntityManager();
EntityGraph eg = em.createEntityGraph("graph.invoice");
List<Invoice> invoiceList =  em.createNamedQuery("invoice.all").setHint("javax.persistence.fetchgraph", eg).getResultList();

If I use javax.persistence.load graph everything OK, but if i use javax.persistence.fetchgraph I have an exception:

org.eclipse.persistence.exceptions.QueryException Exception Description: You must define a fetch group manager at descriptor (Invoice) in order to set a fetch group on the query (invoice.all)


In EclipseLink webpage write:

... using Weaving technologi..

Weaving and Java EE Application Servers

The default EclipseLink weaving behavior applies in any Java EE JPA-compliant application server using the EclipseLink JPA persistence provider. To change this behavior, modify your persistence.xml file (for your JPA entities or POJO classes) to use EclipseLink JPA properties, EclipseLink JPA annotations, or both.

If i add -javaagent:eclipselink.jar in GlassFish Admin console JVM options for dinamic weaving, I have get an exception when start GF.

I dont understand what is the problem. :(
Re: EntityGraph not working in GlassFish [message #1777555 is a reply to message #1776574] Thu, 30 November 2017 10:05 Go to previous message
Georgi Georgiev is currently offline Georgi GeorgievFriend
Messages: 1
Registered: November 2017
Junior Member
Hi there,

have you found any solution?
I'm struggling with the same problem.

Thanks,
Georgi
Previous Topic:L2 cache coordination in Wildfly
Next Topic:Custom query to load list in bidirectional onetomany relationship
Goto Forum:
  


Current Time: Tue Dec 12 16:04:26 GMT 2017

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

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