Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Attribute lazy fetching problem
Attribute lazy fetching problem [message #809637] Wed, 29 February 2012 04:16 Go to next message
Alex Timakov is currently offline Alex TimakovFriend
Messages: 1
Registered: February 2012
Junior Member
Hi all.

I have a simple question.

How can i get an unfetched value of an entity attribute marked in my jpa as

@Basic (fetch = FetchType.LAZY)
@Column(name="DEPARTMENT_NAME", nullable = false, length = 30)
private String departmentName;
when i try to use a getter method in a client unit:

SessionEJB sessionEJB = (SessionEJB)context.lookup("EJBAppEx1-Model-SessionEJB#geo.model.SessionEJB");
List<Departments> f = (List<Departments>)sessionEJB.getDepartmentsFindAll();
Departments d10 = f.get(10);
String name = d10.getDepartmentName();

i get the error:

java.lang.IllegalStateException: Cannot get unfetched attribute [departmentName] from detached object geo.model.Departments@a22e0c.
at org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(EntityFetchGroup.java:92)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.processUnfetchedAttribute(EntityManagerImpl.java:2360)
at geo.model.Departments._persistence_checkFetched(Departments.java)
at geo.model.Departments._persistence_get_departmentName(Departments.java)
at geo.model.Departments.getDepartmentName(Departments.java:65)
at geo.model.SessionEJBClient.main(SessionEJBClient.java:22)

Thanks in advance. Alex
Re: Attribute lazy fetching problem [message #809942 is a reply to message #809637] Wed, 29 February 2012 13:23 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2012.02.28 21:16, Alex Timakov wrote:
> Hi all.
>
> I have a simple question.
>
> How can i get an unfetched value of an entity attribute marked in my jpa as
> @Basic (fetch = FetchType.LAZY)
> @Column(name="DEPARTMENT_NAME", nullable = false, length = 30)
> private String departmentName;
> when i try to use a getter method in a client unit:
>
> SessionEJB sessionEJB =
> (SessionEJB)context.lookup("EJBAppEx1-Model-SessionEJB#geo.model.SessionEJB");
>
> List<Departments> f =
> (List<Departments>)sessionEJB.getDepartmentsFindAll();
> Departments d10 = f.get(10);
> String name = d10.getDepartmentName();
>
> i get the error:
>
> java.lang.IllegalStateException: Cannot get unfetched attribute
> [departmentName] from detached object mailto:geo.model.Departments@a22e0c.
> at
> org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(EntityFetchGroup.java:92)
>
> at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.processUnfetchedAttribute(EntityManagerImpl.java:2360)
>
> at geo.model.Departments._persistence_checkFetched(Departments.java)
> at geo.model.Departments._persistence_get_departmentName(Departments.java)
> at geo.model.Departments.getDepartmentName(Departments.java:65)
> at geo.model.SessionEJBClient.main(SessionEJBClient.java:22)
>
> Thanks in advance. Alex

This forum is for Eclipse, not Java/JEE, questions. You'll get more help
with something like this at javaranch.com or stackoverflow.com although
someone might be helpful in the Eclipse data tools platform forum.
Previous Topic:problems in updation
Next Topic:Problem with Google Plug-In
Goto Forum:
  


Current Time: Thu Apr 25 00:04:41 GMT 2024

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

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

Back to the top