Arithmetic Operations on EObjects / ELists [message #785971] |
Sun, 29 January 2012 15:33  |
Eclipse User |
|
|
|
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 #787116 is a reply to message #786782] |
Tue, 31 January 2012 02:09  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.13947 seconds