openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <da...@6degrees.com>
Subject Re: SingleFieldManager.preFlushPC
Date Fri, 28 Aug 2009 18:11:09 GMT
On Fri, Aug 28, 2009 at 1:46 PM, Michael Dick <michael.d.dick@gmail.com>wrote:

>
> The scenario you've described doesn't sound right (maybe I need a
> refresher). The new ShippingInstructions object should be unmanaged unless
> you've managed to inject a StateManager into it (which would be a good
> trick).
>

No, I've never injected anything in my life. I'm working in Tomcat. I'm
still confused, if an object has a state manager it's managed? Doesn't a
detached object have a state manager? Here's my unit test (as clean as
possible):

User editingUser = em.find(User.class, userOneId);
ScheduledAssignment saOne = setup.insertScheduledAssignment(...);
TimeTrackingEntry entry = new TimeTrackingEntry();
entry.setScheduledAssignment(saOne);
entry.setStartTime(startTime);
entry.setStartTime(endTime);
em = setup.getEntityManager(); // different em than above, simulating
different thread/web transaction
User editingUserClone = new User();
editingUserClone.setId(editingUser.getId());
editingUserClone.setArchived(editingUser.isArchived());
... more property copying
entry.setAddedBy(editingUserClone);
entry.setAddedOn(Calendar.getInstance().getTime());
em.getTransaction().begin();
em.merge(entry);
em.getTransaction().commit(); // expected this to fail, but it works


>
> Out of idle curiosity do you have any properties set in persistence.xml? Or
> should I be able to reproduce this with OpenJPA's default configuration?
>

<property name="openjpa.LockManager" value="none" />
<property name="openjpa.DetachState" value="loaded(AccessUnloaded=false)" />

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message