cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

QuerySpec for DB query

T_Reynolds
3-Visitor

QuerySpec for DB query

Need help converting the blow sql into QuerySpec

 

SELECT *
FROM DISCRETEACTIONITEM DAI
JOIN ITERATEDACTIONITEMSUBJECTLINK ISL ON DAI.IDA2A2 = ISL.IDA3A5
JOIN CONTROLBRANCH CB ON ISL.BRANCHIDA3B5 = CB.IDA2A2
JOIN WTPARTMASTER PM ON CB.IDA3B5 = PM.IDA2A2;

1 ACCEPTED SOLUTION

Accepted Solutions

No longer have this issue, managed to smash the keyboard enought times to produce the following:

QuerySpec qs = new QuerySpec();

int i = qs.appendClassList(DiscreteActionItem.class, true);
int j = qs.appendClassList(IteratedActionItemSubjectLink.class,
false);
int k = qs.appendClassList(ControlBranch.class, false);

int l = qs.appendClassList(WTPartMaster.class, true);

qs.appendWhere(new SearchCondition(DiscreteActionItem.class,
"thePersistInfo.theObjectIdentifier.id",
IteratedActionItemSubjectLink.class,
"roleAObjectRef.key.id"), new int[] { i, j });

qs.appendAnd();

qs.appendWhere(
new SearchCondition(IteratedActionItemSubjectLink.class,
"roleBObjectRef.key.branchId", ControlBranch.class,
"thePersistInfo.theObjectIdentifier.id"),
new int[] { j, k });

qs.appendAnd();

qs.appendWhere(
new SearchCondition(ControlBranch.class,
"masterReference.key.id", WTPartMaster.class,
"thePersistInfo.theObjectIdentifier.id"),
new int[] { k, l });

 However, if anyone has a nicer solution, feel free to respond.

View solution in original post

1 REPLY 1

No longer have this issue, managed to smash the keyboard enought times to produce the following:

QuerySpec qs = new QuerySpec();

int i = qs.appendClassList(DiscreteActionItem.class, true);
int j = qs.appendClassList(IteratedActionItemSubjectLink.class,
false);
int k = qs.appendClassList(ControlBranch.class, false);

int l = qs.appendClassList(WTPartMaster.class, true);

qs.appendWhere(new SearchCondition(DiscreteActionItem.class,
"thePersistInfo.theObjectIdentifier.id",
IteratedActionItemSubjectLink.class,
"roleAObjectRef.key.id"), new int[] { i, j });

qs.appendAnd();

qs.appendWhere(
new SearchCondition(IteratedActionItemSubjectLink.class,
"roleBObjectRef.key.branchId", ControlBranch.class,
"thePersistInfo.theObjectIdentifier.id"),
new int[] { j, k });

qs.appendAnd();

qs.appendWhere(
new SearchCondition(ControlBranch.class,
"masterReference.key.id", WTPartMaster.class,
"thePersistInfo.theObjectIdentifier.id"),
new int[] { k, l });

 However, if anyone has a nicer solution, feel free to respond.

Top Tags