This is a migrated thread and some comments may be shown as answers.

Simple OQL query - "extent" ???

5 Answers 174 Views
OQL (OQL specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MWM
Top achievements
Rank 1
MWM asked on 08 Dec 2008, 05:44 PM
I am trying to perform a simple OQL query:

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

Sort by
0
Jan Blessenohl
Telerik team
answered on 09 Dec 2008, 01:59 PM
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.
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
0
Dimitar Kapitanov
Telerik team
answered on 10 Dec 2008, 04:31 PM
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.
0
Erik
Top achievements
Rank 2
answered on 02 Dec 2012, 02:27 PM
hi Dimitar

The link is broken.

Regards Erik
0
Ivailo
Telerik team
answered on 03 Dec 2012, 07:40 AM
Hello Erik,

Here you can find the new link for OQL Select query extents.

Let us know if you find any other discrepancies.

All the best,
Ivailo
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
OQL (OQL specific questions)
Asked by
MWM
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
MWM
Top achievements
Rank 1
Dimitar Kapitanov
Telerik team
Erik
Top achievements
Rank 2
Ivailo
Telerik team
Share this question
or