Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo
[EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533724] Sun, 16 May 2010 10:01 Go to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Hello Eclipse users,

I'm new to EMF. For my next project I want to use EclipseLink as OR-mapper to store data permanently in a database (MySQL in my case). So, I've looked about an appropriate framework and found Teneo for modelling with EMF.

In my next step, I've tried to configure the Manifest file as described in this tutorial. For adding the mysql jdbc driver, which I downloaded beforce, I've copied the jar file in the dropins folder of my Eclipse installation. After this, I've created a simple one-class-model (for testing purposes only) and tried to generate an orm.xml file. As result, I get a NullpointerException with the following error:
15.05.2010 11:07:00 org.eclipse.emf.teneo.classloader.ClassLoaderResolver setClassLoaderStrategy
INFO: Class loader strategy set to: org.eclipse.emf.teneo.classloader.ContextClassLoaderStrategy

I'm absolutely helpless.
What I have exactly to do to integrate the mysql jdbc driver and EclipseLink in EMF Teneo such as in the Hibernate tutorial?

Thanks in advance
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533727 is a reply to message #533724] Sun, 16 May 2010 10:16 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
Do you still see an orm.xml generated (eventhough you get an error)?

Is what you see similar to what is described in this bugzilla?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587

I do not really have good experience with the dropins folder. You can also install some dependencies (mysql, hsqldb)
from this update site:
http://www.elver.org/eclipse/update

Did you add the dependencies to teneo/commons.logging to the model project as described in:
http://wiki.eclipse.org/Teneo/EclipseLink#Generating_the_orm .xml_through_the_menu

As a side remark, I am not sure if your project is for a web (service) application or for a RCP. If it is for a web
(service) application then this project maybe of interest for you:
http://wiki.eclipse.org/Texo

I am currently adding orm-generation to Texo. This will be released in a few days from now.

btw, Teneo is supported on the main EMF newsgroup which I added as a cc to this post.

gr. Martin

philipp.wode@gmx.net wrote:
> Hello Eclipse users,
>
> I'm new to EMF. For my next project I want to use EclipseLink as
> OR-mapper to store data permanently in a database (MySQL in my case).
> So, I've looked about an appropriate framework and found Teneo for
> modelling with EMF.
> In my next step, I've tried to configure the Manifest file as described
> in this http://wiki.eclipse.org/Teneo/EclipseLink For adding the mysql
> jdbc driver, which I downloaded beforce, I've copied the jar file in the
> dropins folder of my Eclipse installation. After this, I've created a
> simple one-class-model (for testing purposes only) and tried to generate
> an orm.xml file. As result, I get a NullpointerException with the
> following error:
>
> 15.05.2010 11:07:00
> org.eclipse.emf.teneo.classloader.ClassLoaderResolver
> setClassLoaderStrategy
> INFO: Class loader strategy set to:
> org.eclipse.emf.teneo.classloader.ContextClassLoaderStrategy
>
> I'm absolutely helpless. What I have exactly to do to integrate the
> mysql jdbc driver and EclipseLink in EMF Teneo such as in the
> http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install ?
>
> Thanks in advance
>


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533737 is a reply to message #533727] Sun, 16 May 2010 12:28 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Quote:
Do you still see an orm.xml generated (eventhough you get an error)?

yes. Also, I've thought there must be a persistence.xml for ORM. Do I need this file or not?

Quote:
Is what you see similar to what is described in this bugzilla?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587

yes. I dont know where I can find the Eclipse log file, but I think thats the error

Quote:
I do not really have good experience with the dropins folder. You can also install some dependencies (mysql, hsqldb)
from this update site:
http://www.elver.org/eclipse/update

Ok, but these are the dependencies for Hibernate. Do they also work for EclipseLink?

Quote:
As a side remark, I am not sure if your project is for a web (service) application or for a RCP. If it is for a web
(service) application then this project maybe of interest for you:
http://wiki.eclipse.org/Texo

I've started a normal empty EMF project to learn what I have to do for installation of EMF Teneo (incl. MySQL and EclipseLink) and the correct configuration work. But until now, I have not reached much more. My main goal is then to integrate the model in a JSF or GWT project.
On the site of your link it is described that you can use Texo for providing model driven development for web application. Is that not similar to Teneo?

I've tried to install Texo from the update site, but before the installation process I get following install detail:
Cannot complete the install because one or more required items could not be found.
  Software being installed: EMFT Texo (Incubation) 0.1.0.v201005141405 (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
  Missing requirement: Texo-annotations-model Edit Support (Incubation) 0.1.0.v201005141405 (org.eclipse.emf.texo.annotations.model.edit 0.1.0.v201005141405) requires 'bundle org.eclipse.core.runtime [3.6.0,3.7.0)' but it could not be found
  Cannot satisfy dependency:
    From: EMFT Texo (Incubation) 0.1.0.v201005141405 (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
    To: org.eclipse.emf.texo.annotations.model.edit [0.1.0,0.2.0)

What I have to do to solve the problem?
Anyway, Texo is an interesting project. But I've also noticed that with the upcoming 2.6 version EMF supports GWT (link). What do you think about this?
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533756 is a reply to message #533737] Sun, 16 May 2010 18:17 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
To handle the EMF specifics Teneo provides a runtime layer which adapts Hibernate/EclipseLink at runtime. Some of these
specifics:
EMF uses custom implementations for Lists this means that you can't use EMF generated code directly with EclipseLink or
Hibernate (you need Teneo). EMF objects must implement a specific interface and EMF adds many methods to an object which
are not necessarily usefull in all cases.

Texo on the other hand generates code which is just plain java (with standard List/Set implementations) without compile
time dependencies on EMF/Texo. This code will work out of the box with EclipseLink/Hibernate without a specific
additional runtime layer. In the end this is a cleaner (imo) solution for server side code. In addition because the
generated code is really 'just' java you are more inline with what other frameworks (such as JSF) are expecting (so less
change of trouble along the way).
See this wiki page for more details:
http://wiki.eclipse.org/Texo/Texo_and_EMF#Why_Texo_.28compar ed_to_EMF.29

Some other advantages of Texo:
- easy customization of generation templates:
http://wiki.eclipse.org/Texo/Template_Overriding
- you can specify additional java annotations in the model which are transferred/maintained in the generated code:
http://wiki.eclipse.org/Texo/Direct_Java_Annotations
- Texo's model-annotation driven approach gives you great control over code and ORM generation.
http://wiki.eclipse.org/Texo/Code_Generation_Details
http://wiki.eclipse.org/Texo/Code_Generation_Patterns

See other comments inline marked with MT>>.

gr. Martin

philipp.wode@gmx.net wrote:
> Quote:
>> Do you still see an orm.xml generated (eventhough you get an error)?
>
> yes. Also, I've thought there must be a persistence.xml for ORM. Do I
> need this file or not?
>
> Quote:
>> Is what you see similar to what is described in this bugzilla?
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587
>
> yes. I dont know where I can find the Eclipse log file, but I think
> thats the error
MT>> Ok, I will take a look in a few days.

>
> Quote:
>> I do not really have good experience with the dropins folder. You can
>> also install some dependencies (mysql, hsqldb) from this update site:
>> http://www.elver.org/eclipse/update
>
> Ok, but these are the dependencies for Hibernate. Do they also work for
> EclipseLink?
MT>> yes the mysql/hsqldb are standard so no hibernate specifics there

>
> Quote:
>> As a side remark, I am not sure if your project is for a web (service)
>> application or for a RCP. If it is for a web (service) application
>> then this project maybe of interest for you:
>> http://wiki.eclipse.org/Texo
>
> I've started a normal empty EMF project to learn what I have to do for
> installation of EMF Teneo (incl. MySQL and EclipseLink) and the correct
> configuration work. But until now, I have not reached much more. My main
> goal is then to integrate the model in a JSF or GWT project.
> On the site of your link it is described that you can use Texo for
> providing model driven development for web application. Is that not
> similar to Teneo?
MT>> See my reply above
>
> I've tried to install Texo from the update site, but before the
> installation process I get following install detail:
MT>> I published a new build just now. Hopefully this is solved.

>
> Cannot complete the install because one or more required items could not
> be found.
> Software being installed: EMFT Texo (Incubation) 0.1.0.v201005141405
> (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
> Missing requirement: Texo-annotations-model Edit Support (Incubation)
> 0.1.0.v201005141405 (org.eclipse.emf.texo.annotations.model.edit
> 0.1.0.v201005141405) requires 'bundle org.eclipse.core.runtime
> [3.6.0,3.7.0)' but it could not be found
> Cannot satisfy dependency:
> From: EMFT Texo (Incubation) 0.1.0.v201005141405
> (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
> To: org.eclipse.emf.texo.annotations.model.edit [0.1.0,0.2.0)
>
> What I have to do to solve the problem?
> Anyway, Texo is an interesting project. But I've also noticed that with
> the upcoming 2.6 version EMF supports GWT
> ( http://wiki.eclipse.org/EMF/New_and_Noteworthy/Helios#Milest one_7).
> What do you think about this?
MT>> The EMF GWT is for the client side, Texo is targeted for the server side (for now). There is another user which
uses EMF GWT/Texo in this way.

--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533770 is a reply to message #533756] Sun, 16 May 2010 21:12 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Thanks for your great help. By the way, the installation of Texo works now. Super

I think also thats the better way to generate code and to integrate other frameworks.

Still three question:
It's the best to explain my first question to an example. EMF provides an observer functionality via notifications and adapters. So, in my GWT project I want to provide the model both, server and client side. On server side I instantiate the model and send it via GWT-RPC to the client. The client can modify the model instance and observes the model changes via an EContentAdapter. Then, the changes should send back to the server and the server updates the database or the xml file. On the Texo Wiki I've read that there is no support for Adapters or something else.
How can I solve this problem? Do you have any idea?

The second question refers to the code generation. By default, Texo generates the code in a src-gen folder. How can I tell Texo to generate the code in the src folder which Eclipse creates automatically?

And my last question: when I place the annotations in the annotationsmodel and then generate the code, where are the previously created annotations in the classes? I can't see anything. Is there also an option therefor? I've thought the annotations would be present in the classes
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533774 is a reply to message #533770] Sun, 16 May 2010 21:31 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
See comments inline, marked with MT>>

gr. Martin

kidsos wrote:
> Thanks for your great help. By the way, the installation of Texo works
> now. Super
>
> I think also thats the better way to generate code and to integrate
> other frameworks.
>
> Still three question:
> It's the best to explain my first question to an example. EMF provides
> an observer functionality via notifications and adapters. So, in my GWT
> project I want to provide the model both, server and client side. On
> server side I instantiate the model and send it via GWT-RPC to the
> client. The client can modify the model instance and observes the model
> changes via an EContentAdapter. Then, the changes should send back to
> the server and the server updates the database or the xml file. On the
> Texo Wiki I've read that there is no support for Adapters or something
> else.
> How can I solve this problem? Do you have any idea?
MT>> This is the correct flow. The idea is that on the server you don't need adapters. These are especially usefull on
the client (in the user interface). On the server it makes more sense (imo) to listen to commit events and dirty checks.
These are normally provided by the ORM solution (Hibernate has it for sure, EclipseLink I am not sure).

I would ask on the EMF newsgroup what the experience is with sending data from the client to the server.

>
> The second question refers to the code generation. By default, Texo
> generates the code in a src-gen folder. How can I tell Texo to generate
> the code in the src folder which Eclipse creates automatically?
MT>> see here:
http://wiki.eclipse.org/Texo/Generate_Artifacts#Setting_the_ output_folder

>
> And my last question: when I place the annotations in the
> annotationsmodel and then generate the code, where are the previously
> created annotations in the classes? I can't see anything. Is there also
> an option therefor? I've thought the annotations would be present in the
> classes
MT>> Teneo currently supports 2 annotationsmodels:
1) code generation: is used to control code generation in detail, but there is no need to create java annotations for this
2) orm/jpa: is used to generate an orm.xml file (right click on an ecore file and you can choose: generate orm), so this
function currently does not use java annotations.

Then there is a separate method to manage java annotations for which there is no annotationsmodel:
http://wiki.eclipse.org/Texo/Direct_Java_Annotations


>


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533806 is a reply to message #533774] Mon, 17 May 2010 07:47 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Still only a disfigurement. When I generate the code I have to manually add the required bundle "org.eclipse.emf.texo" to the Manifest file, otherwise the import (e.g. "org.eclipse.emf.texo.model.AbstractModelObject") cannot be resolved.

One other thing thing is when I add a Model Gen Annotation to an Annotated EClass and then set the Serializable property to true, Serializable will not be implemented (as far as I can see). Could you take a look?

Is it also possible to set a specific package name? Normally, the package name is resolved by the Namespace URI, e.g. "http://model/1.0". Thats not looking very well Better (imo) would be to set it separately such as in the Base Package property of the genmodel in EMF.

Also, I've read in the Wiki that the posibility of inserting JAXB annotations would be usefull. Is it on the roadmap?

[Updated on: Mon, 17 May 2010 07:55]

Report message to a moderator

Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533816 is a reply to message #533806] Mon, 17 May 2010 08:01 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
I will check out the Serializable thing shortly.

For the second point see the packagePath in the EPackage model gen annotation.
http://wiki.eclipse.org/Texo/Code_Generation_Details#EPackag e_Model_Gen_Features

This may also be of interest:
http://wiki.eclipse.org/Texo/Code_Generation_Patterns#Genera te_EMF_dependencies_in_a_separate_package

I am sure you saw this documentation also:
http://wiki.eclipse.org/Texo/Code_Generation_Details#How_to_ create_an_Annotations_Model

gr. Martin

kidsos wrote:
> Still only a disfigurement. When I generate the code I have to manually
> add the required bundle "org.eclipse.emf.texo" to the Manifest file,
> otherwise the import (e.g.
> "org.eclipse.emf.texo.model.AbstractModelObject") cannot be resolved.
> One other thing thing is when I add a Model Gen Annotation to an
> Annotated EClass and then set the Serializable property to true,
> Serializable will not be implemented (as far as I can see). Could you
> take a look?
>
> Is it also possible to set a specific package name? Normally, the
> package name is resolved by the Namespace URI, e.g. "http://model/1.0".
> Better (imo) would be to set it separately such as in the Base Package
> property of the genmodel in EMF.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533834 is a reply to message #533816] Mon, 17 May 2010 09:11 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Thank you very much for your great help. Texo is really unbelievable. Thats what I've searched, combining the features of EMF with the simplicity of Texo which is still in incubation phase.

I'm curious whats coming next with Texo.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #533972 is a reply to message #533834] Mon, 17 May 2010 15:09 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
Thanks for the positive feedback (always nice :-). I published a new build a few mins back which solves the Serializable
issue.

This new build also contains a number of fixes/improvements in the generation of the ORM file. This week I will be
adding some more testcases for ORM generation and update the docs.

gr. Martin

kidsos wrote:
> Thank you very much for your great help. Texo is really unbelievable.
> Thats what I've searched, combining the features of EMF with the
> simplicity of Texo which is still in incubation phase.
> I'm curious whats coming next with Texo.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534057 is a reply to message #533972] Mon, 17 May 2010 20:09 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
At the momemt I'm testing a little bit, e.g. this example. I've adapted to my simple one-class-model (see below).
final DomainModelFactory domainModel = DomainModelPackage.MODELFACTORY; 
		
		CarItem carItem = new CarItem();
		carItem.setCarId(2);
		
		final ModelObject<?> modelObject = ModelResolver.getInstance().getModelObject(carItem);
		for (EStructuralFeature eFeature : modelObject.eClass().getEAllStructuralFeatures()) {
		    System.err.println(eFeature.getName() + ": " + modelObject.eGet(eFeature)); //$NON-NLS-1$
		}

After running the code I got a NoClassDefFoundError respectively a ClassNotFoundException. I've found out that I have to add the "org.eclipse.emf.ecore.xmi" package to the required bundle in the Manifest file. Problem solved I thought. But after rerunning the code I get following exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
	at de.main.Main.main(Main.java:17)
Caused by: java.lang.NullPointerException
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.getEncoding(XMLLoadImpl.java:320)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:128)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
	at org.eclipse.emf.texo.utils.ModelUtils.readEPackagesFromFile(ModelUtils.java:91)
	at de.phil.DomainModelPackage.initialize(DomainModelPackage.java:84)
	at de.phil.DomainModelPackage.<clinit>(DomainModelPackage.java:65)
	... 1 more

Do you have any idea how to solve the problem?
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534063 is a reply to message #534057] Mon, 17 May 2010 20:19 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
I will add this to the docs (adding the dependency).

Regarding the NPE, it tries to read the ecore file (load the model) but the inputstream is null (which occurs if the
file is not there). Can you check if you see an ecore file in the java package containing the generated code?

Then can you check if this ecore file is also present in the output folder (bin/ etc.)? So that it is available at runtime.

gr. Martin

kidsos wrote:
> At the momemt I'm testing a little bit, e.g. this
> http://wiki.eclipse.org/Texo/Runtime_Model#Model-driven_acce ss_to_Pojo.27s
> I've adapted to my simple one-class-model (see below).
>
> final DomainModelFactory domainModel = DomainModelPackage.MODELFACTORY;
>
> CarItem carItem = new CarItem();
> carItem.setCarId(2);
>
> final ModelObject<?> modelObject =
> ModelResolver.getInstance().getModelObject(carItem);
> for (EStructuralFeature eFeature :
> modelObject.eClass().getEAllStructuralFeatures()) {
> System.err.println(eFeature.getName() + ": " +
> modelObject.eGet(eFeature)); //$NON-NLS-1$
> }
>
> After running the code I got a NoClassDefFoundError respectively a
> ClassNotFoundException. I've found out that I have to add the
> "org.eclipse.emf.ecore.xmi" package to the required bundle in the
> Manifest file. Problem solved I thought. But after rerunning the code I
> get following exception:
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at de.main.Main.main(Main.java:17)
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.getEncoding(XMLLo adImpl.java:320)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:128)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
>
> at
> org.eclipse.emf.texo.utils.ModelUtils.readEPackagesFromFile( ModelUtils.java:91)
>
> at de.phil.DomainModelPackage.initialize(DomainModelPackage.jav a:84)
> at de.phil.DomainModelPackage.<clinit>(DomainModelPackage.java:65)
> ... 1 more
>
> Do you have any idea how to solve the problem?


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534070 is a reply to message #534063] Mon, 17 May 2010 21:11 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Quote:
Can you check if you see an ecore file in the java package containing the generated code?

Ok, my mistake. I've manually deleted the ecore file in the output package because it didn't make any sense to me. After regenerating the code all works fine now and the ecore file is still present.

Another question about the Notification (via EContentAdapter) which I've mentioned in a previous post. So the only chance to add this adapter is adding the adapter in the model level such as in the example. Thereabout?
modelObject.eClass().eAdapters().add(new EContentAdapter(){

			@Override
			public void notifyChanged(Notification notification) {
				// TODO Auto-generated method stub
				super.notifyChanged(notification);
				// do something
			}
		});

Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534077 is a reply to message #534070] Mon, 17 May 2010 21:28 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
This would add an adapter to the eclass (so listening for changes on the eclass) and not the instance.
I intentionally ignored adapters/notifiers in the generated code because afaics it is of less/no use on the server.

Can you describe a bit for what you want to use it on the server side? To get a feel for what you want to achieve.

gr. Martin

kidsos wrote:
> Quote:
>> Can you check if you see an ecore file in the java package containing
>> the generated code?
>
> Ok, my mistake. I've manually deleted the ecore file in the output
> package because it didn't make any sense to me. After regenerating the
> code all works fine now and the ecore file is still present.
>
> Another question about the Notification (via EContentAdapter) which I've
> mentioned in a previous post. So the only chance to add this adapter is
> adding the adapter in the model level such as in the example. Thereabout?
>
> modelObject.eClass().eAdapters().add(new EContentAdapter(){
>
> @Override
> public void notifyChanged(Notification notification) {
> // TODO Auto-generated method stub
> super.notifyChanged(notification);
> // do something
> }
> });
>
>



--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534138 is a reply to message #534077] Tue, 18 May 2010 08:21 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Ok, good to know.

Quote:
Can you describe a bit for what you want to use it on the server side? To get a feel for what you want to achieve.

Not for the server side, I want to add the adapter on the client side. The advantage of the EContentAdapter is yet that it recursively adds to any child element in a model and observe changes in the complete object tree. So, e.g. in a GWT project the user interacts with the UI and can add, remove or modify any child element in the model instance. So, which posibility do I have to observe changes without adapters (only on client side)?
That there is no need for adapters on server side I entitle you.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534154 is a reply to message #534138] Tue, 18 May 2010 08:37 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
I fully agree that an adapter makes sense for the client. In the basis adding an adapter to the generated code is not
that difficult for primitive types. For List/Set associations it needs some thought. I don't want to use custom
collection types. This gives many issues when integrating with ORM's.

So I can think of the following, all access to many associations is through methods on the entity itself. This is
already generated by Texo (generateSafeManyAccess), see the addTo and removeFrom methods. Maybe for lists I can add the
addTo(index, object) and removeFrom(index) methods. That's easy. Then the notifier would be called from these methods
and no specific list/set implementation is needed.

I can try a first implementation but you would be the alpha-user and it would be great if you can provide me some
feedback on the generated adapter api. Let me know if you are willing to 'play' this role. As it sounds interesting (and
not difficult) I can take care of this 1-2 days.

gr. Martin

kidsos wrote:
> Ok, good to know.
>
> Quote:
>> Can you describe a bit for what you want to use it on the server side?
>> To get a feel for what you want to achieve.
>
> Not for the server side, I want to add the adapter on the client side.
> The advantage of the EContentAdapter is yet that it recursively adds to
> any child element in a model and observe changes in the complete object
> tree. So, e.g. in a GWT project the user interacts with the UI and can
> add, remove or modify any child element in the model instance. So, which
> posibility do I have to observe changes without adapters (only on client
> side)?
> That there is no need for adapters on server side I entitle 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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534339 is a reply to message #534154] Tue, 18 May 2010 17:43 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
That sounds good.
Quote:
I can try a first implementation but you would be the alpha-user and it would be great if you can provide me some
feedback on the generated adapter api. Let me know if you are willing to 'play' this role. As it sounds interesting (and
not difficult) I can take care of this 1-2 days.

No problem. Last but not least I promise me to solve a certain problem (observing the model) and when I can support you for giving feedback I'm game.

Also, I've played around with XML de-serialization. It's really simple with Texo. But what if I have a certain XML output structure in mind. Formerly, I used JAXB annotations for this in my classes. Now, with the posibilities of EMF and Texo it would be the ideal candidate to do this in a model driven way because Texo already uses an annotationsmodel.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534364 is a reply to message #534339] Tue, 18 May 2010 20:30 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
See comments inline.

gr. Martin

kidsos wrote:
> That sounds good.
> Quote:
>> I can try a first implementation but you would be the alpha-user and
>> it would be great if you can provide me some feedback on the generated
>> adapter api. Let me know if you are willing to 'play' this role. As it
>> sounds interesting (and not difficult) I can take care of this 1-2 days.
>
> No problem. Last but not least I promise me to solve a certain problem
> (observing the model) and when I can support you for giving feedback I'm
> game.
MT>> Okay great, one thing I mentioned that I wanted to use the addTo/removeFrom methods on the entity to send out
notifications. But then I had a second thought that this does not work for cases where an external framework (like gwt)
expects to work directly with the lists. So I need to spend some more thoughts on this.

>
> Also, I've played around with XML de-serialization. It's really simple
> with Texo. But what if I have a certain XML output structure in mind.
> Formerly, I used JAXB annotations for this in my classes. Now, with the
> posibilities of EMF and Texo it would be the ideal candidate to do this
> in a model driven way because Texo already uses an annotationsmodel.
MT>> I have been thinking on adding jaxb as one of the annotations models.. That's quite doable afaics.

However the next question is if these model annotations should be generated (as the ORM generator does for ORM) or are
they completely manual. JAXB model annotations could be generated on the basis of the ExtendedMetaData information which
is stored in the ecore model.Just some thoughts.

Btw, if this topic interests you, I wellcome contributions or people who want to work with me on this :-).


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534455 is a reply to message #534364] Wed, 19 May 2010 09:26 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Quote:
So I need to spend some more thoughts on this.

You only have to say when you want to start. Another thing is how we can communicate your results and my feedback? I mean my first post has nothing more to do with my current request and flooding the forum with posts is also not the best way to implement and test a new feature. What do you think?

Quote:
However the next question is if these model annotations should be generated (as the ORM generator does for ORM) or are
they completely manual. JAXB model annotations could be generated on the basis of the ExtendedMetaData information which
is stored in the ecore model.Just some thoughts.

I prefer the manual way because imo it's cleaner. But when ExtendedMetaData information exist it's also possible to generate annotations from this.

Quote:
Btw, if this topic interests you, I wellcome contributions or people who want to work with me on this.

You mean donations. I ask you because in German there are several meanings for the word "contributions". So, it's not clear what you mean Wink
And work with you. Well, I am not sure if I am the right man to do this. I am not familiar with plugin development. Actually, I am glad to understand halfway OOP and coding Java web applications for my own purposes. But I am pleased to help wherever I can.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534467 is a reply to message #534455] Wed, 19 May 2010 09:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
I created two bugzillas to track the changes:
notifier implementation:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=313493
JAXB annotations model:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=313494

If you add your email to these bugzillas then you will see changes, questions, remarks from my side. If you can reply
that would be great.Then if there is something to test/try it out it would be great if you can do that.

Regarding contributions, I agree that it helps if you have plugin development experience. It would already help if you
can help with knowledge on jaxb (which I don't have). Do you know if it is possible to specify jaxb annotations in xml
for example (is there a xml schema for it, that would make live very much easier)? Also here testing and giving feedback
would already be great.

gr. Martin

kidsos wrote:
> Quote:
>> So I need to spend some more thoughts on this.
>
> You only have to say when you want to start. Another thing is how we can
> communicate your results and my feedback? I mean my first post has
> nothing more to do with my current request and flooding the forum with
> posts is also not the best way to implement and test a new feature. What
> do you think?
>
> Quote:
>> However the next question is if these model annotations should be
>> generated (as the ORM generator does for ORM) or are they completely
>> manual. JAXB model annotations could be generated on the basis of the
>> ExtendedMetaData information which is stored in the ecore model.Just
>> some thoughts.
>
> I prefer the manual way because imo it's cleaner. But when
> ExtendedMetaData information exist it's also possible to generate
> annotations from this.
>
> Quote:
>> Btw, if this topic interests you, I wellcome contributions or people
>> who want to work with me on this.
>
> You mean donations. I ask you because in German there are several
> meanings for the word "contributions". So, it's not clear what you mean ;)
> And work with you. Well, I am not sure if I am the right man to do this.
> I am not familiar with plugin development. Actually, I am glad to
> understand halfway OOP and coding Java web applications for my own
> purposes. But I am pleased to help wherever I can.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534497 is a reply to message #534467] Wed, 19 May 2010 11:18 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Quote:
Do you know if it is possible to specify jaxb annotations in xml
for example (is there a xml schema for it, that would make live very much easier)?

Could this here help you?
Quote:
Then if there is something to test/try it out it would be great if you can do that.

How this is exactly going on? I have never done beforce something like this. So, e.g. you release a file on Bugzilla and I can test it.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #534537 is a reply to message #534497] Wed, 19 May 2010 12:28 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
See reaction inline.

gr. Martin


kidsos wrote:
> Quote:
>> Do you know if it is possible to specify jaxb annotations in xml for
>> example (is there a xml schema for it, that would make live very much
>> easier)?
>
> Could this http://java.sun.com/xml/ns/jaxb/ help you?
MT>> hmm afaics, that is used to generate java classes from a xml schema (correct me if I am wrong). I think I will go a
different route, it was my plan anyway to create a java-annotation-->ecore converter, this is a good reason to start
doing this. The advantage of directly translating java annotations (the @interface class) to ecore is that this makes it
very easy later to generate the java annotations from the ecore model again.

> Quote:
>> Then if there is something to test/try it out it would be great if you
>> can do that.
>
> How this is exactly going on? I have never done beforce something like
> this. So, e.g. you release a file on Bugzilla and I can test it.
MT>> I will make these changes available in new builds so you can download them through the update manager. I can easily
do multiple builds a day.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #535108 is a reply to message #534537] Fri, 21 May 2010 10:21 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Hi

How is it going forward with the implementation if I may ask you?
Quote:
hmm afaics, that is used to generate java classes from a xml schema (correct me if I am wrong)

Have to think about this over again. You are right. In fact, it's the same like the orm.xml

One thing I noticed. When defining an EClass (with EOpperations) as an interface in EMF Texo generates an empty interface without any of the previously defined methods. Is this the correct way?
I have expected that Texo generates the interface with method stubs and the implementing class overrides these methods.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #535127 is a reply to message #535108] Fri, 21 May 2010 11:28 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
I choose to first work on Jaxb. I wrote a java-annotation--> ecore converter to convert the jaxb annotations to an ecore
model. This works fine. Now I am changing some other part of Texo to support multiple annotation model files. After that
I need to generate the jaxb annotation editor and translating jaxb annotations to java annotations when generating code
(which is easy as the names/structure in ecore are exactly the same as the corresponding java annotations).

Regarding notifiers, I still need to think of a nice solution for adapters in case of list associations and
bi-directional associations. I have thought about it but have not found a good solution....

EOperations are not yet supported. This because I am not sure about their practical usage. I mean you always need to set
generatedNOT on the generated method to implement its body (to prevent it from being overwritten in the next generation
run). So the EOperation is used once to generate a method stub and after that it is practically ignored. Ofcourse this
is less apparent when generating an interface with EOperations, so there there is more reason to use EOperations... But
then I am not the biggest fan of interfaces in general (many times an abstract class is as fine and it provides better
api stability towards the future). Having said all this my experience with EOperations is limited, maybe others have
more/better experience.
You can always enter a bugzilla for it to trigger the implementation of this part. I for sure intend to cover it, as it
is an EMF/ecore feature.

gr. Martin

kidsos wrote:
> Hi
>
> How is it going forward with the implementation if I may ask you?
> Quote:
>> hmm afaics, that is used to generate java classes from a xml schema
>> (correct me if I am wrong)
>
> Have to think about this over again. You are right. In fact, it's the
> same like the orm.xml
>
> One thing I noticed. When defining an EClass (with EOpperations) as an
> interface in EMF Texo generates an empty interface without any of the
> previously defined methods. Is this the correct way?
> I have expected that Texo generates the interface with method stubs and
> the implementing class overrides these methods.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #535243 is a reply to message #535127] Fri, 21 May 2010 17:32 Go to previous messageGo to next message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
I have still thought about the annotations model. At the moment Texo supports 2 annotations models (ORM annotation with EclipseLink as default and the annotation for model generation itself, see Wiki). But, e.g. for JPA, there are several frameworks which I can use (Hibernate, OpenJPA and so on). Annotations models for other frameworks like Spring, EJB or whatever are also imaginable. So, my question is: how can I ensure which OR mapper is used?
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #535251 is a reply to message #535243] Fri, 21 May 2010 18:03 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
Texo uses the eclipselink orm 2.0 xsd (which is under EPL) which basically is the orm 2.0 spec with some additional
EclipseLink mappings. The orm generated by Texo only contains standard orm 2.0 spec content (at least afaics). So to use
it for another ORM provider the only thing which needs to be done is change the namespace uri in the beginning to:
http://java.sun.com/xml/ns/persistence/orm

(I have not tested this though...).

When editing the orm annotation with the annotations model editor you should take care of using standard orm annotations
(my feel was that there are only a few non-standard ones in there).

Most ORM vendors have custom extensions to the orm spec. The ones for Hibernate are not yet supported in xml. It is not
that much work to add a new annotations model to Texo, the ORM/JPA code took me 2-3 days of work. So my longer term plan
is to support custom extensions (to orm 2.0.xsd) on the basis of user requests (that's also what I did with Teneo, when
someone needed a custom extension from Hibernate I added it). Or hopefully other people who are interested in this topic
can contribute ofcourse, that would be great to.

gr. Martin

kidsos wrote:
> I have still thought about the annotations model. At the moment Texo
> supports 2 annotations models (ORM annotation with EclipseLink as
> default and the annotation for model generation itself, see Wiki). But,
> e.g. for JPA, there are several frameworks which I can use (Hibernate,
> OpenJPA and so on). Annotations models for other frameworks like Spring,
> EJB or whatever are also imaginable. So, my question is: how can I
> ensure which OR mapper is used?


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622890 is a reply to message #533727] Sun, 16 May 2010 12:28 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Quote:
> Do you still see an orm.xml generated (eventhough you get an error)?

yes. Also, I've thought there must be a persistence.xml for ORM. Do I need this file or not?

Quote:
> Is what you see similar to what is described in this bugzilla?
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587

yes. I dont know where I can find the Eclipse log file, but I think thats the error

Quote:
> I do not really have good experience with the dropins folder. You can also install some dependencies (mysql, hsqldb)
> from this update site:
> http://www.elver.org/eclipse/update

Ok, but these are the dependencies for Hibernate. Do they also work for EclipseLink?

Quote:
> As a side remark, I am not sure if your project is for a web (service) application or for a RCP. If it is for a web
> (service) application then this project maybe of interest for you:
> http://wiki.eclipse.org/Texo

I've started a normal empty EMF project to learn what I have to do for installation of EMF Teneo (incl. MySQL and EclipseLink) and the correct configuration work. But until now, I have not reached much more. My main goal is then to integrate the model in a JSF or GWT project.
On the site of your link it is described that you can use Texo for providing model driven development for web application. Is that not similar to Teneo?

I've tried to install Texo from the update site, but before the installation process I get following install detail:

Cannot complete the install because one or more required items could not be found.
Software being installed: EMFT Texo (Incubation) 0.1.0.v201005141405 (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
Missing requirement: Texo-annotations-model Edit Support (Incubation) 0.1.0.v201005141405 (org.eclipse.emf.texo.annotations.model.edit 0.1.0.v201005141405) requires 'bundle org.eclipse.core.runtime [3.6.0,3.7.0)' but it could not be found
Cannot satisfy dependency:
From: EMFT Texo (Incubation) 0.1.0.v201005141405 (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
To: org.eclipse.emf.texo.annotations.model.edit [0.1.0,0.2.0)

What I have to do to solve the problem?
Anyway, Texo is an interesting project. But I've also noticed that with the upcoming 2.6 version EMF supports GWT ( http://wiki.eclipse.org/EMF/New_and_Noteworthy/Helios#Milest one_7). What do you think about this?
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622891 is a reply to message #622890] Sun, 16 May 2010 18:17 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
To handle the EMF specifics Teneo provides a runtime layer which adapts Hibernate/EclipseLink at runtime. Some of these
specifics:
EMF uses custom implementations for Lists this means that you can't use EMF generated code directly with EclipseLink or
Hibernate (you need Teneo). EMF objects must implement a specific interface and EMF adds many methods to an object which
are not necessarily usefull in all cases.

Texo on the other hand generates code which is just plain java (with standard List/Set implementations) without compile
time dependencies on EMF/Texo. This code will work out of the box with EclipseLink/Hibernate without a specific
additional runtime layer. In the end this is a cleaner (imo) solution for server side code. In addition because the
generated code is really 'just' java you are more inline with what other frameworks (such as JSF) are expecting (so less
change of trouble along the way).
See this wiki page for more details:
http://wiki.eclipse.org/Texo/Texo_and_EMF#Why_Texo_.28compar ed_to_EMF.29

Some other advantages of Texo:
- easy customization of generation templates:
http://wiki.eclipse.org/Texo/Template_Overriding
- you can specify additional java annotations in the model which are transferred/maintained in the generated code:
http://wiki.eclipse.org/Texo/Direct_Java_Annotations
- Texo's model-annotation driven approach gives you great control over code and ORM generation.
http://wiki.eclipse.org/Texo/Code_Generation_Details
http://wiki.eclipse.org/Texo/Code_Generation_Patterns

See other comments inline marked with MT>>.

gr. Martin

philipp.wode@gmx.net wrote:
> Quote:
>> Do you still see an orm.xml generated (eventhough you get an error)?
>
> yes. Also, I've thought there must be a persistence.xml for ORM. Do I
> need this file or not?
>
> Quote:
>> Is what you see similar to what is described in this bugzilla?
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587
>
> yes. I dont know where I can find the Eclipse log file, but I think
> thats the error
MT>> Ok, I will take a look in a few days.

>
> Quote:
>> I do not really have good experience with the dropins folder. You can
>> also install some dependencies (mysql, hsqldb) from this update site:
>> http://www.elver.org/eclipse/update
>
> Ok, but these are the dependencies for Hibernate. Do they also work for
> EclipseLink?
MT>> yes the mysql/hsqldb are standard so no hibernate specifics there

>
> Quote:
>> As a side remark, I am not sure if your project is for a web (service)
>> application or for a RCP. If it is for a web (service) application
>> then this project maybe of interest for you:
>> http://wiki.eclipse.org/Texo
>
> I've started a normal empty EMF project to learn what I have to do for
> installation of EMF Teneo (incl. MySQL and EclipseLink) and the correct
> configuration work. But until now, I have not reached much more. My main
> goal is then to integrate the model in a JSF or GWT project.
> On the site of your link it is described that you can use Texo for
> providing model driven development for web application. Is that not
> similar to Teneo?
MT>> See my reply above
>
> I've tried to install Texo from the update site, but before the
> installation process I get following install detail:
MT>> I published a new build just now. Hopefully this is solved.

>
> Cannot complete the install because one or more required items could not
> be found.
> Software being installed: EMFT Texo (Incubation) 0.1.0.v201005141405
> (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
> Missing requirement: Texo-annotations-model Edit Support (Incubation)
> 0.1.0.v201005141405 (org.eclipse.emf.texo.annotations.model.edit
> 0.1.0.v201005141405) requires 'bundle org.eclipse.core.runtime
> [3.6.0,3.7.0)' but it could not be found
> Cannot satisfy dependency:
> From: EMFT Texo (Incubation) 0.1.0.v201005141405
> (org.eclipse.emf.texo.feature.group 0.1.0.v201005141405)
> To: org.eclipse.emf.texo.annotations.model.edit [0.1.0,0.2.0)
>
> What I have to do to solve the problem?
> Anyway, Texo is an interesting project. But I've also noticed that with
> the upcoming 2.6 version EMF supports GWT
> ( http://wiki.eclipse.org/EMF/New_and_Noteworthy/Helios#Milest one_7).
> What do you think about this?
MT>> The EMF GWT is for the client side, Texo is targeted for the server side (for now). There is another user which
uses EMF GWT/Texo in this way.

--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622892 is a reply to message #533756] Sun, 16 May 2010 21:12 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Thanks for your great help. By the way, the installation of Texo works now. Super

I think also thats the better way to generate code and to integrate other frameworks.

Still three question:
It's the best to explain my first question to an example. EMF provides an observer functionality via notifications and adapters. So, in my GWT project I want to provide the model both, server and client side. On server side I instantiate the model and send it via GWT-RPC to the client. The client can modify the model instance and observes the model changes via an EContentAdapter. Then, the changes should send back to the server and the server updates the database or the xml file. On the Texo Wiki I've read that there is no support for Adapters or something else.
How can I solve this problem? Do you have any idea?

The second question refers to the code generation. By default, Texo generates the code in a src-gen folder. How can I tell Texo to generate the code in the src folder which Eclipse creates automatically?

And my last question: when I place the annotations in the annotationsmodel and then generate the code, where are the previously created annotations in the classes? I can't see anything. Is there also an option therefor? I've thought the annotations would be present in the classes
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622893 is a reply to message #622892] Sun, 16 May 2010 21:31 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
See comments inline, marked with MT>>

gr. Martin

kidsos wrote:
> Thanks for your great help. By the way, the installation of Texo works
> now. Super
>
> I think also thats the better way to generate code and to integrate
> other frameworks.
>
> Still three question:
> It's the best to explain my first question to an example. EMF provides
> an observer functionality via notifications and adapters. So, in my GWT
> project I want to provide the model both, server and client side. On
> server side I instantiate the model and send it via GWT-RPC to the
> client. The client can modify the model instance and observes the model
> changes via an EContentAdapter. Then, the changes should send back to
> the server and the server updates the database or the xml file. On the
> Texo Wiki I've read that there is no support for Adapters or something
> else.
> How can I solve this problem? Do you have any idea?
MT>> This is the correct flow. The idea is that on the server you don't need adapters. These are especially usefull on
the client (in the user interface). On the server it makes more sense (imo) to listen to commit events and dirty checks.
These are normally provided by the ORM solution (Hibernate has it for sure, EclipseLink I am not sure).

I would ask on the EMF newsgroup what the experience is with sending data from the client to the server.

>
> The second question refers to the code generation. By default, Texo
> generates the code in a src-gen folder. How can I tell Texo to generate
> the code in the src folder which Eclipse creates automatically?
MT>> see here:
http://wiki.eclipse.org/Texo/Generate_Artifacts#Setting_the_ output_folder

>
> And my last question: when I place the annotations in the
> annotationsmodel and then generate the code, where are the previously
> created annotations in the classes? I can't see anything. Is there also
> an option therefor? I've thought the annotations would be present in the
> classes
MT>> Teneo currently supports 2 annotationsmodels:
1) code generation: is used to control code generation in detail, but there is no need to create java annotations for this
2) orm/jpa: is used to generate an orm.xml file (right click on an ecore file and you can choose: generate orm), so this
function currently does not use java annotations.

Then there is a separate method to manage java annotations for which there is no annotationsmodel:
http://wiki.eclipse.org/Texo/Direct_Java_Annotations


>


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622894 is a reply to message #533774] Mon, 17 May 2010 07:47 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Still only a disfigurement. When I generate the code I have to manually add the required bundle "org.eclipse.emf.texo" to the Manifest file, otherwise the import (e.g. "org.eclipse.emf.texo.model.AbstractModelObject") cannot be resolved.

One other thing thing is when I add a Model Gen Annotation to an Annotated EClass and then set the Serializable property to true, Serializable will not be implemented (as far as I can see). Could you take a look?

Is it also possible to set a specific package name? Normally, the package name is resolved by the Namespace URI, e.g. "http://model/1.0". Better (imo) would be to set it separately such as in the Base Package property of the genmodel in EMF.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622895 is a reply to message #533806] Mon, 17 May 2010 08:01 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
I will check out the Serializable thing shortly.

For the second point see the packagePath in the EPackage model gen annotation.
http://wiki.eclipse.org/Texo/Code_Generation_Details#EPackag e_Model_Gen_Features

This may also be of interest:
http://wiki.eclipse.org/Texo/Code_Generation_Patterns#Genera te_EMF_dependencies_in_a_separate_package

I am sure you saw this documentation also:
http://wiki.eclipse.org/Texo/Code_Generation_Details#How_to_ create_an_Annotations_Model

gr. Martin

kidsos wrote:
> Still only a disfigurement. When I generate the code I have to manually
> add the required bundle "org.eclipse.emf.texo" to the Manifest file,
> otherwise the import (e.g.
> "org.eclipse.emf.texo.model.AbstractModelObject") cannot be resolved.
> One other thing thing is when I add a Model Gen Annotation to an
> Annotated EClass and then set the Serializable property to true,
> Serializable will not be implemented (as far as I can see). Could you
> take a look?
>
> Is it also possible to set a specific package name? Normally, the
> package name is resolved by the Namespace URI, e.g. "http://model/1.0".
> Better (imo) would be to set it separately such as in the Base Package
> property of the genmodel in EMF.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622896 is a reply to message #533816] Mon, 17 May 2010 09:11 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Thank you very much for your great help. Texo is really unbelievable. Thats what I've searched, combining the features of EMF with the simplicity of Texo which is still in incubation phase.

I'm curious whats coming next with Texo.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622898 is a reply to message #622896] Mon, 17 May 2010 15:09 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
Thanks for the positive feedback (always nice :-). I published a new build a few mins back which solves the Serializable
issue.

This new build also contains a number of fixes/improvements in the generation of the ORM file. This week I will be
adding some more testcases for ORM generation and update the docs.

gr. Martin

kidsos wrote:
> Thank you very much for your great help. Texo is really unbelievable.
> Thats what I've searched, combining the features of EMF with the
> simplicity of Texo which is still in incubation phase.
> I'm curious whats coming next with Texo.


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622899 is a reply to message #533972] Mon, 17 May 2010 20:09 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
At the momemt I'm testing a little bit, e.g. this http://wiki.eclipse.org/Texo/Runtime_Model#Model-driven_acce ss_to_Pojo.27s I've adapted to my simple one-class-model (see below).

final DomainModelFactory domainModel = DomainModelPackage.MODELFACTORY;

CarItem carItem = new CarItem();
carItem.setCarId(2);

final ModelObject<?> modelObject = ModelResolver.getInstance().getModelObject(carItem);
for (EStructuralFeature eFeature : modelObject.eClass().getEAllStructuralFeatures()) {
System.err.println(eFeature.getName() + ": " + modelObject.eGet(eFeature)); //$NON-NLS-1$
}

After running the code I got a NoClassDefFoundError respectively a ClassNotFoundException. I've found out that I have to add the "org.eclipse.emf.ecore.xmi" package to the required bundle in the Manifest file. Problem solved I thought. But after rerunning the code I get following exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
at de.main.Main.main(Main.java:17)
Caused by: java.lang.NullPointerException
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.getEncoding(XMLLo adImpl.java:320)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:128)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
at org.eclipse.emf.texo.utils.ModelUtils.readEPackagesFromFile( ModelUtils.java:91)
at de.phil.DomainModelPackage.initialize(DomainModelPackage.jav a:84)
at de.phil.DomainModelPackage.<clinit>(DomainModelPackage.java:65)
... 1 more

Do you have any idea how to solve the problem?
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622900 is a reply to message #622899] Mon, 17 May 2010 20:19 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
I will add this to the docs (adding the dependency).

Regarding the NPE, it tries to read the ecore file (load the model) but the inputstream is null (which occurs if the
file is not there). Can you check if you see an ecore file in the java package containing the generated code?

Then can you check if this ecore file is also present in the output folder (bin/ etc.)? So that it is available at runtime.

gr. Martin

kidsos wrote:
> At the momemt I'm testing a little bit, e.g. this
> http://wiki.eclipse.org/Texo/Runtime_Model#Model-driven_acce ss_to_Pojo.27s
> I've adapted to my simple one-class-model (see below).
>
> final DomainModelFactory domainModel = DomainModelPackage.MODELFACTORY;
>
> CarItem carItem = new CarItem();
> carItem.setCarId(2);
>
> final ModelObject<?> modelObject =
> ModelResolver.getInstance().getModelObject(carItem);
> for (EStructuralFeature eFeature :
> modelObject.eClass().getEAllStructuralFeatures()) {
> System.err.println(eFeature.getName() + ": " +
> modelObject.eGet(eFeature)); //$NON-NLS-1$
> }
>
> After running the code I got a NoClassDefFoundError respectively a
> ClassNotFoundException. I've found out that I have to add the
> "org.eclipse.emf.ecore.xmi" package to the required bundle in the
> Manifest file. Problem solved I thought. But after rerunning the code I
> get following exception:
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at de.main.Main.main(Main.java:17)
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.getEncoding(XMLLo adImpl.java:320)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:128)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
>
> at
> org.eclipse.emf.texo.utils.ModelUtils.readEPackagesFromFile( ModelUtils.java:91)
>
> at de.phil.DomainModelPackage.initialize(DomainModelPackage.jav a:84)
> at de.phil.DomainModelPackage.<clinit>(DomainModelPackage.java:65)
> ... 1 more
>
> Do you have any idea how to solve the problem?


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622901 is a reply to message #534063] Mon, 17 May 2010 21:11 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Quote:
> Can you check if you see an ecore file in the java package containing the generated code?

Ok, my mistake. I've manually deleted the ecore file in the output package because it didn't make any sense to me. After regenerating the code all works fine now and the ecore file is still present.

Another question about the Notification (via EContentAdapter) which I've mentioned in a previous post. So the only chance to add this adapter is adding the adapter in the model level such as in the example. Thereabout?

modelObject.eClass().eAdapters().add(new EContentAdapter(){

@Override
public void notifyChanged(Notification notification) {
// TODO Auto-generated method stub
super.notifyChanged(notification);
// do something
}
});
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622902 is a reply to message #622901] Mon, 17 May 2010 21:28 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
This would add an adapter to the eclass (so listening for changes on the eclass) and not the instance.
I intentionally ignored adapters/notifiers in the generated code because afaics it is of less/no use on the server.

Can you describe a bit for what you want to use it on the server side? To get a feel for what you want to achieve.

gr. Martin

kidsos wrote:
> Quote:
>> Can you check if you see an ecore file in the java package containing
>> the generated code?
>
> Ok, my mistake. I've manually deleted the ecore file in the output
> package because it didn't make any sense to me. After regenerating the
> code all works fine now and the ecore file is still present.
>
> Another question about the Notification (via EContentAdapter) which I've
> mentioned in a previous post. So the only chance to add this adapter is
> adding the adapter in the model level such as in the example. Thereabout?
>
> modelObject.eClass().eAdapters().add(new EContentAdapter(){
>
> @Override
> public void notifyChanged(Notification notification) {
> // TODO Auto-generated method stub
> super.notifyChanged(notification);
> // do something
> }
> });
>
>



--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622903 is a reply to message #534077] Tue, 18 May 2010 08:21 Go to previous message
kidsos is currently offline kidsos
Messages: 26
Registered: May 2010
Junior Member
Ok, good to know.

Quote:
> Can you describe a bit for what you want to use it on the server side? To get a feel for what you want to achieve.

Not for the server side, I want to add the adapter on the client side. The advantage of the EContentAdapter is yet that it recursively adds to any child element in a model and observe changes in the complete object tree. So, e.g. in a GWT project the user interacts with the UI and can add, remove or modify any child element in the model instance. So, which posibility do I have to observe changes without adapters (only on client side)?
That there is no need for adapters on server side I entitle you.
Re: [EMF Teneo] problems with integration of MySQL and EclipseLink in EMF Teneo [message #622904 is a reply to message #622903] Tue, 18 May 2010 08:37 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Philipp,
I fully agree that an adapter makes sense for the client. In the basis adding an adapter to the generated code is not
that difficult for primitive types. For List/Set associations it needs some thought. I don't want to use custom
collection types. This gives many issues when integrating with ORM's.

So I can think of the following, all access to many associations is through methods on the entity itself. This is
already generated by Texo (generateSafeManyAccess), see the addTo and removeFrom methods. Maybe for lists I can add the
addTo(index, object) and removeFrom(index) methods. That's easy. Then the notifier would be called from these methods
and no specific list/set implementation is needed.

I can try a first implementation but you would be the alpha-user and it would be great if you can provide me some
feedback on the generated adapter api. Let me know if you are willing to 'play' this role. As it sounds interesting (and
not difficult) I can take care of this 1-2 days.

gr. Martin

kidsos wrote:
> Ok, good to know.
>
> Quote:
>> Can you describe a bit for what you want to use it on the server side?
>> To get a feel for what you want to achieve.
>
> Not for the server side, I want to add the adapter on the client side.
> The advantage of the EContentAdapter is yet that it recursively adds to
> any child element in a model and observe changes in the complete object
> tree. So, e.g. in a GWT project the user interacts with the UI and can
> add, remove or modify any child element in the model instance. So, which
> posibility do I have to observe changes without adapters (only on client
> side)?
> That there is no need for adapters on server side I entitle 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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Child comparison problem
Next Topic:[Texo] not possible to define Embedded-id in orm
Goto Forum:
  


Current Time: Tue Oct 21 12:20:56 GMT 2014

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

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