Re: OpenJPA1.2.2 - NativeQuery - IN clause

2009-08-31 Thread Fay Wang
Just wanted to mention that JPQL allows collection parameter in the IN clause. String jpql = "select count(e.eid), e from Entity e, Property p where e.eid=p.refersTo and p.type IN ( ?1 ) group by e.eid order by count(e.eid) desc"; In this case, you can set a Collection object to the parameter:

Re: OpenJPA1.2.2 - NativeQuery - IN clause

2009-08-31 Thread Fay Wang
Hi, For native query: String sql = "select count(e.eid), e.* from Entity e, Property p where e.eid=p.refersTo and p.type IN ( ?1 ) group by e.eid order by count(e.eid) desc"; As you observed, the following parameter setting will work, since you have only one parameter marker: query.setPar

Re: OpenJPA1.2.2 - NativeQuery - IN clause

2009-08-31 Thread Kevin Sutter
Hi, This is not my area of expertise. But since ?1 refers to a single parameter, and you mentioned that "A" is a valid value with successful results, I would try something like " 'A', 'B' ". Another alternative would be to list additional parameters, ie. ?1, ?2, ?3, etc. But, of course, this wou

OpenJPA1.2.2 - NativeQuery - IN clause

2009-08-31 Thread HaricotBean
Which type is NativeQuery expecting for a parameter that maps to a IN clause? Through trial and error I found that Collections cause an error to be throw and Arrays execute but return no results. However if I pass a single String value it works... @NamedNativeQuery(name = "Entity.mostRefersType

Re: How to persist then update in same transaction

2009-08-31 Thread Rick Curtis
When running your application in JSE mode, are you calling em.getTransaction().begin(commit())? I'm willing to bet you aren't and that is why your test works in JSE, but fails on WAS. -Rick On Mon, Aug 31, 2009 at 12:48 PM, Diane J wrote: > > I do the following in one transaction: > > OrgType o

How to persist then update in same transaction

2009-08-31 Thread Diane J
I do the following in one transaction: OrgType orgType = new OrgType(); getOrgTypeDAO().persist(orgType); Organization org = new Organization(); org.setOrgName("Test"); org.setOrgTypeId(orgType.getOrgTypeId()); getOrganizationDAO().persist(org); orgType.setOwnerOrgId(org.getOrgId()); getOrgTypeDA