Unable to fetch object by id in JDOQL - jdo

I am pretty naive to hbase and JDO. I was trying to use
Query q = pm.newQuery(MyClass.class, "id == " + taskId);
List<MyClass> taskList = (List<MyClass>)q.execute();
But to my disappointment the list I am receiving is blank. although the taskId in the argument is already present.
Any kind of help would highly appreciable.
Thanks in advance!!

If fetching an object by id then would make way more sense to call
pm.getObjectById(...)
and if using a query, it would be normal to look at the log

try
taskList = (List) pm.detachCopy(taskList);
after your code

Related

olapR query returns null object

I have been using olapR (along with Microsoft R Client, which you need in order to use olapR) to do MDX queries on a MSOLAP database.
However, every time I execute any query it return a null object. I know these are not empty queries. Here is an example:
library(olapR)
cnnstr="Provider=MSOLAP;Password=***;Persist Security Info=True;User ID=***;Data Source=***;Initial Catalog=***"
olapCnn=OlapConnection(cnnstr)
qry <- Query(validate = TRUE)
cube(qry) <- "PER - Prestación Servicios de Salud"
columns(qry) <- c("[Measures].[Número Personas Atendidas]")
rows(qry) <- c("[Diagnóstico Principal].[Diagnósticos].[Diagnósticos].MEMBERS")
results1=executeMD(olapCnn, qry)
The problem is results1 is NULL.
If I use the command execute2D instead I get the following error:
Unknown object recieved from olapRExecuteRecordset, which is just a consequence of the object being return being NULL
Since the author has not answered here, I can tell how I solved this in case someone else has maybe the same issue.
Basically I'm using 2-3 cubes, but I had only used the connection string to one of the cubes, so when I tried to query the other cubes I got the NULL object, or unknown object received. The solution in my case was simply to create different connection strings for each of the cubes, and use the correct connection string when querying.

Except string datatype, not getting any columns populated through AIF Service

I have a simple custom table in AX, for which i need to create a Web service so that data could be populated by an external system. I created a Document service with all the Axd* and Ax* objects involved. Next i wrote a simple console application to try populating some dummy data. Interesting thing is i can only get string data type columns populated. Int, Real, Date, Enums etc are not coming through.
In the code below, i am only getting StoreItemId and Barcode columns, as both are strings. Cost is real, ErrorType is Enum, DocketDate is date and none of them get any values. I have discussed this issue with many colleagues and none is aware whats happening. Does anyone know or could point me in some new direction? Thanks a lot.
PS - I have limited experience with AIF and if i am missing something fundamental, please excuse and do let me know. Thanks.
AxdEntity_MMSStagingSalesImport stagingSalesImport = new AxdEntity_MMSStagingSalesImport();
stagingSalesImport.StoreItemId = "9999";
stagingSalesImport.Barcode = "1234546";
stagingSalesImport.Cost = 22;
stagingSalesImport.ErrorType = AxdEnum_MMSImportErrorType.Posting;
stagingSalesImport.DocketDate = new DateTime(2014, 4, 4);
stagingSalesImport.IsDuplicate = AxdEnum_NoYes.Yes;
For some types, you have to specify that you have set the values, so that AX knows the difference between a null value and a value that is set:
stagingSalesImport.Cost = 22;
stagingSalesImport.CostSpecified = true;
stagingSalesImport.ErrorType = AxdEnum_MMSImportErrorType.Posting;
stagingSalesImport.ErrorTypeSpecified = AxdEnum_MMSImportErrorType.Posting;
Thanks for replying Klaas, i like your blog as well.
Should have responded earlier but i fixed the issue.
I didn't try Klaas's option but i had a look at the data policies for the inbound port and found that none of the columns were enabled. I enabled the ones i needed and made most of them required as well. And guess what, that worked. I was expecting that the columns should have been enabled by default.

How to get Mongo update query status in c#

I need to get the update query status means, whether the query executed successfully or not. How do i achieve this.
MongoCollection<BsonDocument> Updatecollection =
MongoDBs.GetCollection<BsonDocument>(collectionName);
Updatecollection.Update(query, update, UpdateFlags.Multi);
this is the way i used to update my collection, Please help me to get the query status.
thanks in advance
Siva
The Update method returns a WriteConcernResult object that contains the results of the update.
See the docs for the details of that object.
For example:
var result = Updatecollection.Update(query, update, UpdateFlags.Multi);
Console.WriteLine("{0} docs updated", result.DocumentsAffected);

Dynamic values in Simple.Data

Please see below line of code for assistance.
private static readonly dynamic db= Database.OpenNamedConnection("DefaultConnectionString");
var idRecord = db.TableName.FindAll(db.TableName.phoneNo == phoneNo && db.TableName.password == pass).FirstOrDefault();
My question is, how can I see the value of db.TableName.phoneNo during Debug.
Any help is welcome.
Thanks.
Liaqat
The only way to debug this is to have the query output to the console. Then you can run it in your database. For more information, see this question. How to log generated sql queries out of Simple.Data ORM for .NET

llblgen: How do i filter?

Im having some problems with filtering data with LLBLGen. I have an EmployeeEntity where i want to fetch the data filtering by string CustomerNumber. CustomerNumber is not Primary Key. I guess i have to use the IPredicateExpression, but how?
EDIT: Im using the Adapter Model.
You'll need to do something like this:
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.PredicateExpression.Add(EmployeeFields.CustomerNumber == "123");
You can find a much more in-depth discussion here.
EmployeeCollection employees = new EmployeeCollection();
employees.GetMulti(EmployeeFields.CustomerNumber == "123");
You can fetch lists using DataAccessAdapter.FetchEntities. The filtering can be done via PredicateExpressions. A nice documentation of the predicate system can be found here.

Resources