|
Re: Attribute lazy fetching problem [message #809942 is a reply to message #809637] |
Wed, 29 February 2012 13:23 |
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.09179 seconds