Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO/Hibernate] Count all objects in a resource(How to count all objects stored in a database by given resource id)
[CDO/Hibernate] Count all objects in a resource [message #1369477] Tue, 20 May 2014 15:57 Go to next message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
Hello,

I have CDO/Hibernate with MySQL database. My model (ecore file) consists of several packages and subpackages.

I have several instances of my model which are stored as separate resources

Is there a way to count all objects in all packages and subpackages for a given resources (maybe by using hibernate query)?

Thank you.

Re: [CDO/Hibernate] Count all objects in a resource [message #1383954 is a reply to message #1369477] Tue, 27 May 2014 11:57 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5339
Registered: July 2009
Senior Member
Hi Evgeny,
The resource contents is a multi-level containment structure which can contain objects of different types which are
stored in different tables. You can count the direct contents of the resource, but I think it is not possible directly
to count the content of a resource. If your number of types is limited you could do a count query for each individual
type filtering on the resource id. See my reply to your other question on how to filter on each object.

gr. Martin

On 20-05-14 17:57, Evgeny Karataev wrote:
> Hello,
>
> I have CDO/Hibernate with MySQL database. My model (ecore file) consists of several packages and subpackages.
>
> I have several instances of my model which are stored as separate resources
>
> Is there a way to count all objects in all packages and subpackages for a given resources (maybe by using hibernate query)?
>
> Thank you.
>
>


--

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: [CDO/Hibernate] Count all objects in a resource [message #1383968 is a reply to message #1383954] Tue, 27 May 2014 13:58 Go to previous messageGo to next message
Evgeny Karataev is currently offline Evgeny KarataevFriend
Messages: 18
Registered: May 2014
Junior Member
Hello Martin,

Thank you for your reply.

I will try what you've suggested and will write back here if I was successful or not.
Re: [CDO/Hibernate] Count all objects in a resource [message #1385310 is a reply to message #1369477] Thu, 05 June 2014 14:20 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 20-05-14 17:57, Evgeny Karataev wrote:
> Hello,
>
> I have CDO/Hibernate with MySQL database. My model (ecore file) consists
> of several packages and subpackages.
>
> I have several instances of my model which are stored as separate resources
>
> Is there a way to count all objects in all packages and subpackages for
> a given resources (maybe by using hibernate query)?
Why don't you count the CDOObjects table, which keeps a reference for
each object, you could even count it by type, I believe:

(In my case mysql).

SELECT COUNT(CDO_ID) FROM TM.CDO_OBJECTS;

>
> Thank you.
>
>
Previous Topic:Casting Object to EObject
Next Topic:[CDO] Critical issues with CDO Workspaces
Goto Forum:
  


Current Time: Sun Nov 23 00:59:34 GMT 2014

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

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