goldmansachs/reladomo

Getting exception when tried to join a table with equalsEdgePoint()

Closed this issue · 9 comments

Getting below exception when tried to join table with equalsEdgePoint().

Sample Reladomo Query:
DocumentFinder.authors().processingDate().equalsEdgePoint()
.and(DocumentFinder.authors().processingDateTo().greaterThan())

Exception :
can't join with non-standard as-operation com.gs.fw.common.mithra.finder.asofop.AsOfEdgePointOperation processingDate

What are you trying to accomplish?

Hi @mohrezaei
I want to get active documents for which any author closed (left) in last x days. Here both entities (document and author) follow audit only chaining. is it possible to join a entity with other by using equalsEdgePoint().

There is a simple query for that:

DocumentFinder.authors().processingDateFrom().greaterThan(xDaysAgo)

On second thought that only looks for new authors. I think you also want removed authors. It's probably best to start that on the author side and deep fetch the documents instead. Something like:

AuthorList removedAuthors = AuthorFinder.processingDate().equalsEdgePoint().and(AuthorFinder.processingDateTo().greaterThan(xDaysAgo).and(AuthorFinder.processingDateTo().notEq(infinity));
removedAuthors.deepFetch(AuthorFinder.documents());

@mohrezaei ,
I don't need authors. I just want to use authors in where clause to fetch required documents.
So is it possible to go like this?
`

// requiredDocs = documents with author removed in last xdays or has an author with infinity end date.

DocumentList requiredDocs = DocumentFinder.authors().equalsEdgePoint().and(DocumentFinder.authors().processingDateTo().greaterThan(xDaysAgo))

Things are getting more complex to me when I want to aggregate this data or adding few more operations on document attributes.

The code I provided gives the same result.

Alternatively, try defining a new relationship to authors, where the relationship clause includes equalsEdgePoint. looks like this:

<Relationship name="itemsForAllTime" relatedObject="AuditedOrderItem"
 cardinality="one-to-many">
AuditedOrderItem.orderId = this.orderId and AuditedOrderItem.processingDate equalsEdgePoint
</Relationship>

As I need to use few complex queries and it seems very challenging in this way. Can you please let me know if there is any way to write object queries like HQL or native queries in reladomo.

Please read the philosophy and vision document. String based queries are a serious anti-pattern and they will never be supported.