I remember fixing an issue when query parameter is an entity (manged,
detached or unmanaged). But can not recollect when (which version), where
(which code) or which JIRA issue.

If memory serves me right, the fix effectively translates query parameter
bound to an entity to the primary key values of the entity internally (for
an unmanaged entity that was bit tricky).


Kevin Sutter wrote:
> 
> Hi Daryl,
> All that I can say is that the posting you referenced is almost two years
> old and it may have been resolved in the release that you ran against. 
> What
> version of OpenJPA did you try to reproduce the problem with?  I did a
> quick
> search of our JIRA's to see if this has been resolved, but I couldn't find
> an exact match.
> 
> Kevin
> 
> On Tue, Sep 8, 2009 at 7:28 AM, Daryl Stultz <[email protected]> wrote:
> 
>> Hey,
>> Through some wacky querying I came across this:
>>
>>
>> http://n2.nabble.com/Persistent-entities-pass-as-params-to-JPQL-queries-MUST-be-attached-Query-getSingleResult-bug-or-exp-td209033.html
>>
>> I tried to verify this but could not. Here's a simple attempt:
>>
>> User user = new User();
>> user.setId(userId);
>> Query query = em.createQuery("select o from ScheduledAssignment as o
>> where
>> o.user = :user");
>> query.setParameter("user", user);
>> System.out.println(query.getSingleResult()); // also works with
>> getResultList (there's only one)
>>
>> This works just fine. Can anyone set the issue straight? Thanks.
>>
>> --
>> Daryl Stultz
>> _____________________________________
>> 6 Degrees Software and Consulting, Inc.
>> http://www.6degrees.com
>> mailto:[email protected]
>>
> 
> 


-----
Pinaki 
-- 
View this message in context: 
http://n2.nabble.com/Parameters-must-be-managed-tp3602926p3608475.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to