here we go: https://issues.apache.org/jira/browse/OPENJPA-1030

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 09.04.2009 um 13:05 schrieb Marc Logemann:

Hi,

explicitly detaching is only possible via OpenJPA product API right? No, i have not done that explicitly, it was implicit at context end. And yes, as written earlier, i experimented with all 3 DetachState levels and "all" worked like expected. I even had an annoyance with "loaded" when explicitly defined in contrast to leaving it out alltogether.

I will file a jira with mainly my main mail from yesterday.....

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 09.04.2009 um 12:30 schrieb Craig L Russell:

It's worth a JIRA.

Detachment occurs either at context end or at explicit detach.

Does this anomalous behavior occur if you explicitly detach your entities, or only implicitly at context end?

And have you changed the openjpa.DetachState configuration property which governs how objects are detached?

Craig

On Apr 8, 2009, at 11:57 PM, Marc Logemann wrote:

is this worth a JIRA ?

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 08.04.2009 um 23:50 schrieb Tedman Leung:

just as additional information, this is also true about any lazy
PersistentCollection too. I found that if I accessed the collection while it is in an attached state the values are available, but as soon as it becomes detached the collection becomes null even if I had just accessed
it prior to detachment.

I'm not entirely sure if this is a bug or if it's suppose to work this way
when detached.

On Wed, Apr 08, 2009 at 05:18:48PM +0200, Marc Logemann wrote:
Hi,

with OpenJPA 1.2.0 i am having some problems detaching attributes which
are in a fetch-group. My persistence.xml is:

<property name="openjpa.DetachState" value="fetch-
groups(DetachedStateField=true)"/>

My Domain class header:

@FetchGroups({
@FetchGroup(name="posDetail", attributes={
    @FetchAttribute(name="deliveryAddresses")
})
})
public class Order {

@OneToMany(mappedBy = "order", cascade = CascadeType.ALL, fetch =
FetchType.LAZY)
List<DeliveryAddress> deliveryAddresses;
...
}

(in fact i also have the @LoadFetchGroup("posDetail") to be sure.....)

Now when i am leaving my DAO layer which means that the persistence contexts ends, the delivery address is "null" even though its in the
fetch group. I even queried for the fetch group in the DAO before
leaving it via:

OpenJPAQuery oQuery = OpenJPAPersistence.cast(em.createQuery("select o
from Order o where o.oid = ?1"));
    oQuery.setParameter(1, oid);
    //
oQuery .getFetchPlan().setMaxFetchDepth(3).addFetchGroup("posDetail");
    List list = oQuery.getResultList();
    if(list != null && list.size() > 0)  {
        return (Order)list.iterator().next();
    }

I know it must be a detach issue because with the following
persistence.xml it works (but i definitely wont use this config in
production)

<property name="openjpa.DetachState" value="all"/>

Am i missing something here? When i debug my DAO, the deliveryAddress
attribute is populated but as soon as i leave my DAO, its lost.

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de





--
                                                       Ted Leung
ted...@sfu.ca

I can speak Canadian, American, Australian, and little English.



Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:craig.russ...@sun.com
P.S. A good JDO? O, Gasp!



Reply via email to