In part inspired by this post from ACDC, I wanted to create a Query object with a peer-multiple reference to other objects. I would then add the relevant objects to the Query BO and subsequently use that as a dynamically created list for further processing. Because the Query is only required within the context of a process, I thought that I could use a not-persisted object for this purpose.
By way of example:
I created a (not-persisted) BO named NP_Query which has a peer-multiple attribute named Accounts of type Account, and ItemsCounter attribute.
The simplified process:
Code: Select all
CREATE NP_Query
FIND ALL Account
INSERT Account IN Query.Accounts
NP_Query.ItemsCounter = COUNT Account WHERE (Account IN NP_Query.Accounts)
DISPLAY MESSAGE 'Number of Accounts: <<NP_Query.ItemsCounter>>'
If I use exactly the same code as above but substitute 'NP_Query' by a regular persisted Query object, it works fine.
Note that the Account object in this example is a regular persisted object, so that's not the issue.
Also, the not-persisted object can actually hold a reference, because
Code: Select all
NP_Query.Accounts = Account
It seems that to deal with the multiple reference attribute, Aware requires a separate reference table which is either not created for not-persisted objects or it is created in memory whereas Aware is looking at the normal database and can't find it. In either case, I can't use multiple references in a not-persisted BO. Which is unfortunate, as this means that I need to resort to a regular persisted object which puts additional load on the database server and requires to manually remove the Query object after use.com.bas.basserver.persistence.PersistenceException: Error executing a query SELECT COUNT(*) FROM BASTESTDOMAINAPP_ACCOUNT AS Account LEFT JOIN BASTESTDOMAINAPP_NP_QUERY_REF AS NP_Query_Accounts_RO ON NP_Query_Accounts_RO.RID=Account.ID AND NP_Query_Accounts_RO.ID=18 AND NP_Query_Accounts_RO.FIELD_NAME='Accounts' WHERE ((NP_Query_Accounts_RO.ID=18)) message is (conn=11929) Table 'basdbtest.bastestdomainapp_np_query_ref' doesn't exist
If I am overlooking something or if there is a work-around, I'd be happy to hear.