Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Arithmetic Operations on EObjects / ELists
Arithmetic Operations on EObjects / ELists [message #785971] Sun, 29 January 2012 20:33 Go to next message
Lars Briem is currently offline Lars BriemFriend
Messages: 22
Registered: June 2011
Junior Member
Hello everybody,

At the moment I am working on a software to log different tasks which were done over the year by different persons. As database backend I use hibernate to store the data of the EMF objects in the database.
My question is now. Is it possible to make different calculations on the numbers of some ELists / EObjects.

Small example:
I have an EList where all elements of the type "Task" are stored in. A Task contains a start date, an end date, a person who did the Task and some other attributes.
Now I want to calculate the number of houres each person has worked over a given time interval.

At the moment I know two ways how I can do this, but I do not know if these are the right ways or if there is a better way to do this.

1. way:
Writing a custom content provider which iterates over the Task list and calculates the values for each person.

2. way:
Using EMF Model Query Statements to calcutate the values like it would be done with SQL Statements.


So what do you think is the best of the two ways or is there a third way I do not know at the moment?
Re: Arithmetic Operations on EObjects / ELists [message #786282 is a reply to message #785971] Mon, 30 January 2012 08:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
And why are you not useing HQL?

Tom

Am 29.01.12 21:33, schrieb Lars Briem:
> Hello everybody,
>
> At the moment I am working on a software to log different tasks which
> were done over the year by different persons. As database backend I use
> hibernate to store the data of the EMF objects in the database. My
> question is now. Is it possible to make different calculations on the
> numbers of some ELists / EObjects.
>
> Small example:
> I have an EList where all elements of the type "Task" are stored in. A
> Task contains a start date, an end date, a person who did the Task and
> some other attributes.
> Now I want to calculate the number of houres each person has worked over
> a given time interval.
>
> At the moment I know two ways how I can do this, but I do not know if
> these are the right ways or if there is a better way to do this.
>
> 1. way:
> Writing a custom content provider which iterates over the Task list and
> calculates the values for each person.
>
> 2. way:
> Using EMF Model Query Statements to calcutate the values like it would
> be done with SQL Statements.
>
>
> So what do you think is the best of the two ways or is there a third way
> I do not know at the moment?
Re: Arithmetic Operations on EObjects / ELists [message #786782 is a reply to message #786282] Mon, 30 January 2012 20:14 Go to previous messageGo to next message
Lars Briem is currently offline Lars BriemFriend
Messages: 22
Registered: June 2011
Junior Member
Thanks for your reply. Please correct me if I am wrong, but I thought the architecture of an application like the one I am developing would be build up like the following layer model:

application layers
EMF
hibernate
database

With the use of HQL on the application layers, I would bypass the EMF layer and would directly connect to hibernate. Is that the right way?

Because I think then I will loose a lot of functionality, flexability and abstraction which EMF provides e.g. manipulating the data on the application layers without knowledge of the backend technologie.

So in this case I do not want not use HQL for this job because I do not want to have a dependency from the application layers to hibernate.
Re: Arithmetic Operations on EObjects / ELists [message #787116 is a reply to message #786782] Tue, 31 January 2012 07:09 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Am 30.01.12 21:14, schrieb Lars Briem:
> Thanks for your reply. Please correct me if I am wrong, but I thought
> the architecture of an application like the one I am developing would be
> build up like the following layer model:
>
> application layers
> EMF
> hibernate
> database
>
> With the use of HQL on the application layers, I would bypass the EMF
> layer and would directly connect to hibernate. Is that the right way?
>

Yes and no - see below on my preferred layer

> Because I think then I will loose a lot of functionality, flexability
> and abstraction which EMF provides e.g. manipulating the data on the
> application layers without knowledge of the backend technologie.
>
> So in this case I do not want not use HQL for this job because I do not
> want to have a dependency from the application layers to hibernate.

To me the layers look like this:

--------------------
| App-Layer |
------ --------------------
| |
| | --------------------
| EMF| | Data-Access-Layer|
| | --------------------
| |
------ --------------------
| Hibernate |
--------------------

--------------------
| Database |
--------------------

The Data-Access-Layer has the advantage that you can use storage
specific stuff (e.g. HQL) in there while your App-Layer is not getting a
direct dependency on the storage. Using the storage specific stuff is
needed to gain performance e.g. when doing calculations because when the
data you are working with is getting big loading all objects in memory
is not an option anymore.

EMF itself is not a layer for me but the a way to route data from
backend-layers to the application layers.

Combine this with OSGi-Services and you have a extremly powerful.

Tom
Previous Topic:Cannot install EMF SDK on Eclipse 3.8M4
Next Topic:Is a class type possible to extends A class type and implements B interface type?
Goto Forum:
  


Current Time: Thu Sep 19 13:35:48 GMT 2024

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

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

Back to the top