Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Using EObjectStore to select column values
Using EObjectStore to select column values [message #1064636] Thu, 20 June 2013 11:08 Go to next message
Kacper Zając is currently offline Kacper ZającFriend
Messages: 2
Registered: June 2013
Junior Member
Hello,
I have created model (domain and persistence classes) using Texo / ecore and I am using
EObjectStore.query to make database queries. For queries which result is collection
of ecore model classes it works fine.
Problem occurs, when I want to select something different. F.e. specific values from single column or use aggregate functions.
For query:
select sum(e.workingHours) from timesheet_TimeSheetEntry as e
I am getting exception like:

java.lang.IllegalStateException: The class class java.lang.Long is not managed by this ModelResolver

Class may vary - it depends on select statement. You can get same exception with java.lang.String or java.lang.Integer

Could you advise me what should I do to get this type of queries working ?

Cheers,
Kacper
Re: Using EObjectStore to select column values [message #1065045 is a reply to message #1064636] Mon, 24 June 2013 04:34 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Kacper,
Sorry for the later reply.. The EObjectStore has an api which returns EObjects. I think the best solution for you is to
use the EntityManagerFactory (for example from the EntityManagerProvider) directly to get an EntityManager and from then
on query in the standard JPA way.

Or are you using a JSONEObjectStore?

gr. Martin

On 06/20/2013 02:45 PM, Kacper Zając wrote:
> Hello,
> I have created model (domain and persistence classes) using Texo / ecore and I am using
> EObjectStore.query to make database queries. For queries which result is collection of ecore model classes it works fine.
> Problem occurs, when I want to select something different. F.e. specific values from single column or use aggregate
> functions.
> For query:
> select sum(e.workingHours) from timesheet_TimeSheetEntry as e
> I am getting exception like:
>
> java.lang.IllegalStateException: The class class java.lang.Long is not managed by this ModelResolver
>
> Class may vary - it depends on select statement. You can get same exception with java.lang.String or java.lang.Integer
>
> Could you advise me what should I do to get this type of queries working ?
>
> Cheers,
> Kacper


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Using EObjectStore to select column values [message #1065170 is a reply to message #1065045] Mon, 24 June 2013 14:57 Go to previous messageGo to next message
Kacper Zając is currently offline Kacper ZającFriend
Messages: 2
Registered: June 2013
Junior Member
Hi Martin,
Thanks for your reply and clarifying situation. That's the solution I was afraid of.
I have seen that there's implemented functionality for count queries using EObjectStore, and I hoped,
that I won't have to mix EntityManager code with EObjectStore in services.

Actual EObjectStore, which I am using is EPersistenceService, so it's not JSONEObjectStore.

regards,
Kacper
Re: Using EObjectStore to select column values [message #1065174 is a reply to message #1065170] Mon, 24 June 2013 15:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Kacper,
Yes I can see the requirement, but I am bit in doubt on how to add this in a nice way while still following the idea
that an EObjectStore actually stores and retrieves EObjects.
So I can add a free format query api/method to EObjectStore to return such free-results. Or add a new eobject type in
Texo which has an array/list of objects as an efeature to store the data in there and return then a list of these
EObject instances.

Can you enter a bugzilla for this? (with a link to this forum discussion)
Maybe I can solve it somewhat nicely while still following the api/EObjectStore concept.

gr. Martin

On 06/24/2013 04:57 PM, Kacper Zając wrote:
> Hi Martin,
> Thanks for your reply and clarifying situation. That's the solution I was afraid of. I have seen that there's
> implemented functionality for count queries using EObjectStore, and I hoped,
> that I won't have to mix EntityManager code with EObjectStore in services.
>
> Actual EObjectStore, which I am using is EPersistenceService, so it's not JSONEObjectStore.
>
> regards,
> Kacper


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[Texo] How to know attributes of an object in order to make update/insert requests?
Next Topic:[ecp] add operation to context menu
Goto Forum:
  


Current Time: Thu Apr 25 19:23:24 GMT 2024

Powered by FUDForum. Page generated in 0.03043 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top