This question is locked. New answers and comments are not allowed.
I am trying to perform a simple OQL query:
and I get this error:
Invalid syntax: Did you mean '... FROM OrgExtent AS ...' ?
In the online docs, I see the example of "EmployeeExtent". What is this "extent" part?
The name of my table is "Org". I am trying to query a single record whose id equals 1. Any example you can provide or correction to my code would be appreciated.
string
queryString = "select org from Org as org where org.id = \"1\"";
IObjectScope scope = Database.Get("DatabaseConnection1").GetObjectScope();
IQuery oqlQuery = scope.GetOqlQuery(queryString);
IQueryResult result = oqlQuery.Execute();
and I get this error:
Invalid syntax: Did you mean '... FROM OrgExtent AS ...' ?
In the online docs, I see the example of "EmployeeExtent". What is this "extent" part?
The name of my table is "Org". I am trying to query a single record whose id equals 1. Any example you can provide or correction to my code would be appreciated.
5 Answers, 1 is accepted
0
Hello MWM,
OQL is referencing class and fieldnames. ORG is your class name and in OQL the collection of all objects of that type is name OrgExtent.
The query has to be:
"select * from OrgExtent as org where org.id = \"1\"
You should always use parameters instead of hard coded values because our query cache is working getter then.
Kind regards,
Jan Blessenohl
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
OQL is referencing class and fieldnames. ORG is your class name and in OQL the collection of all objects of that type is name OrgExtent.
The query has to be:
"select * from OrgExtent as org where org.id = \"1\"
You should always use parameters instead of hard coded values because our query cache is working getter then.
Kind regards,
Jan Blessenohl
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

MWM
Top achievements
Rank 1
answered on 10 Dec 2008, 04:51 AM
Hi Jan! Thanks for getting back to me.
I figure that Vanatec is responsible for this "Extent" thing, but man! It's bizarre to say the least.
I will give this a try.
FYI - I just posted to: http://www.telerik.com/community/forums/thread/b311D-btthdb.aspx and thought you might want to take a look. Basically I'm seeing a lot of similarities in OA and an open-source ORM called NHibernate. Both products seem to use a mapping file, a "factory" (singleton approach) for the life of the application and then a "scope" for each transaction (NH calls it a "session"). Thing is that NH provides "out-of-the-box" basic CRUD whereas I'm not seeing that for OA, at least for simple things like getting a single record based on a pk. I could be entirely wrong though as I'm new to OA, for only a week or so now.
Thanks again for your assistance.
Mark
I figure that Vanatec is responsible for this "Extent" thing, but man! It's bizarre to say the least.
I will give this a try.
FYI - I just posted to: http://www.telerik.com/community/forums/thread/b311D-btthdb.aspx and thought you might want to take a look. Basically I'm seeing a lot of similarities in OA and an open-source ORM called NHibernate. Both products seem to use a mapping file, a "factory" (singleton approach) for the life of the application and then a "scope" for each transaction (NH calls it a "session"). Thing is that NH provides "out-of-the-box" basic CRUD whereas I'm not seeing that for OA, at least for simple things like getting a single record based on a pk. I could be entirely wrong though as I'm new to OA, for only a week or so now.
Thanks again for your assistance.
Mark
0
Hello MWM,
Just to clarify this further you can take a look at our documentation regarding the Extents part of OQL:
http://www.telerik.com/help/openaccess-orm/oql-the-select-statement-extents.html
Hope this helps.
Regards,
Dimitar Kapitanov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Just to clarify this further you can take a look at our documentation regarding the Extents part of OQL:
http://www.telerik.com/help/openaccess-orm/oql-the-select-statement-extents.html
Hope this helps.
Regards,
Dimitar Kapitanov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Erik
Top achievements
Rank 2
answered on 02 Dec 2012, 02:27 PM
hi Dimitar
The link is broken.
Regards Erik
The link is broken.
Regards Erik
0
Hello Erik,
Ivailo
the Telerik team
Here you can find the new link for OQL Select query extents.
Let us know if you find any other discrepancies.
Ivailo
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.