Re: Fetching a list of objects from a list of primary keys

2016-09-14 Thread John Huss
You can use ExpressionFactory.matchDbExp("pk1", val1).and(ExpressionFactory.matchDbExp("pk2", val2)) Then assemble the resulting AND expressions into a list of OR expressions using ExpressionFactory.or() pk1 = val1 AND pk2 = val2 OR pk1 = val3 AND pk2 = val4 OR pk1 = val5 AND pk2 = val6

Re: Fetching a list of objects from a list of primary keys

2016-09-14 Thread Oksana Peterburgskaya
Hello, I'm currently working on a case related to this post where I try to fetch a list of objects based on a list of primary keys. The difference for me is that the primary key consists of multiple fields id db. If I try to use ObjectForPK(), it accepts such multi-park PKs. However, if I try t

Re: Fetching a list of objects from a list of primary keys

2016-04-14 Thread Hugi Thordarson
Great, thanks! - hugi > On 14. apr. 2016, at 08:50, Andrus Adamchik wrote: > > Here is a shorter version: > > ExpressionFactory.inDbExp( User.ID_PK_COLUMN, 1, 2, 3) > >> On Apr 14, 2016, at 11:15 AM, Hugi Thordarson wrote: >> >> Ah, of course, I can qualify on the DB path even if “id” is

Re: Fetching a list of objects from a list of primary keys

2016-04-14 Thread Andrus Adamchik
Here is a shorter version: ExpressionFactory.inDbExp( User.ID_PK_COLUMN, 1, 2, 3) > On Apr 14, 2016, at 11:15 AM, Hugi Thordarson wrote: > > Ah, of course, I can qualify on the DB path even if “id” is not a class > attribute. Is this the correct way to go about this? > > new ASTIn( new ASTDbP

Re: Fetching a list of objects from a list of primary keys

2016-04-14 Thread Hugi Thordarson
Ah, of course, I can qualify on the DB path even if “id” is not a class attribute. Is this the correct way to go about this? new ASTIn( new ASTDbPath( User.ID_PK_COLUMN ), new ASTList( someListOfIDs() ) ) Thanks, - hugi > On 14. apr. 2016, at 06:34, Andrus Adamchik wrote: > > Actually a sim

Re: Fetching a list of objects from a list of primary keys

2016-04-13 Thread Andrus Adamchik
Actually a simple IN qualifier should work. Andrus > On Apr 12, 2016, at 11:38 AM, Hugi Thordarson wrote: > > Hi all. > I have a list of primary keys [3,4,5,etc…] and I’d like to fetch all the > corresponding objects in one go. > Do I have to expose the primary key of my entity to do this or i