On Tue, Feb 8, 2011 at 2:33 PM, Michael Dick <[email protected]>wrote:

> Out of idle curiosity, why would one insert job1 right away? If you needed
> the objects, but would selectively commit a subset of them, couldn't you
> just create the POJO and merge later?
>
> Or does insertJob start and complete its own transaction?
>
> This is just the way I create objects for unit testing. What's actually
happening is that some old JDBC inserts the records then I find() them with
an EM. So you can think of them as already existing. You could change the
first 2 lines from this:

Role job1 = setup.insertJob("XX_1"); // instantiates and inserts via
ThreadLocal EM

Role job2 = setup.insertJob("XX_2");


to this:

Role job1 = em.find(Role.class, 170);

Role job2 = em.find(Role.class, 171);


This would assume they already have been inserted, like a setUp() method of
a unit test would typically do. This is not a typical scenario for my core
application, but since the data model is exposed to JavaScript, I don't have
any idea what the crazy script writers might do.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
http://www.opentempo.com
mailto:[email protected]

Reply via email to