Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] Generation Code([Texo] Annotation is not correct )
[Texo] Generation Code [message #986298] Mon, 19 November 2012 18:53 Go to next message
gabriele boldrin is currently offline gabriele boldrinFriend
Messages: 19
Registered: December 2009
Junior Member
I found texo ORM generator doesn't process JPA annotation correctly.

Errors:
"import javax.persistence.Index" is wrong, it should be "org.eclipse.persistence.annotations.Index"
"import javax.persistence.Indexs" is wrong, it should be "org.eclipse.persistence.annotations.Indexes"

Result code generation by my test:

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Indexs;

/**
 * A representation of the model object '<em><b>A</b></em>'. <!-- begin-user-doc
 * --> <!-- end-user-doc -->
 * 
 * @generated
 */
@Entity(name = "test_A")
@Indexs({ @Index(columnNames = { "field1", "field2" }, unique = false) })
public class A {

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Basic()
	private String id = null;

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Basic()
	@Index()
	private String name = null;




I have attached my test : test.ecore and test-orm.annotationsmodel
Is this a bug?


Enviroment :
Eclipse Java EE IDE Juno Build id: 20120920-0800
EMF 2.8.1
JPA eclipselink 2.4
EMFT Texo SDK (Incubation) 0.1.0.v201211031957 org.eclipse.emf.texo.sdk.feature.group Eclipse Modeling Project
EMFT Texo (Incubation) 0.1.0.v201211031957 org.eclipse.emf.texo.feature.group Eclipse Modeling Project
  • Attachment: test.zip
    (Size: 1.21KB, Downloaded 70 times)
Re: [Texo] Generation Code [message #986321 is a reply to message #986298] Mon, 19 November 2012 23:14 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Gabriele,
A bug, I solved it and published a new build. Let me know if it still occurs.

gr. MArtin

On 11/19/2012 07:53 PM, gabriele boldrin wrote:
> I found texo ORM generator doesn't process JPA annotation correctly.
>
> Errors:
> "import javax.persistence.Index" is wrong, it should be "org.eclipse.persistence.annotations.Index"
> "import javax.persistence.Indexs" is wrong, it should be "org.eclipse.persistence.annotations.Indexes"
>
> Result code generation by my test:
>
>
> import javax.persistence.Basic;
> import javax.persistence.Entity;
> import javax.persistence.Index;
> import javax.persistence.Indexs;
>
> /**
> * A representation of the model object '<em><b>A</b></em>'. <!-- begin-user-doc
> * --> <!-- end-user-doc -->
> *
> * @generated
> */
> @Entity(name = "test_A")
> @Indexs({ @Index(columnNames = { "field1", "field2" }, unique = false) })
> public class A {
>
> /**
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> *
> * @generated
> */
> @Basic()
> private String id = null;
>
> /**
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> *
> * @generated
> */
> @Basic()
> @Index()
> private String name = null;
>
>
>
>
> I have attached my test : test.ecore and test-orm.annotationsmodel
> Is this a bug?
>
>
> Enviroment :
> Eclipse Java EE IDE Juno Build id: 20120920-0800
> EMF 2.8.1
> JPA eclipselink 2.4
> EMFT Texo SDK (Incubation) 0.1.0.v201211031957 org.eclipse.emf.texo.sdk.feature.group Eclipse Modeling Project
> EMFT Texo (Incubation) 0.1.0.v201211031957 org.eclipse.emf.texo.feature.group Eclipse Modeling Project
>


--

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: [Texo] Generation Code [message #986391 is a reply to message #986298] Tue, 20 November 2012 10:14 Go to previous messageGo to next message
gabriele boldrin is currently offline gabriele boldrinFriend
Messages: 19
Registered: December 2009
Junior Member
I have found other errors.


Annotation Multitenant
The imports are wrong, but this time the generation of annotations is incorrect
See you http://wiki.eclipse.org/EclipseLink/Examples/JPA/Multitenant

Example:

package test;

...
import javax.persistence.Multitenant;
import javax.persistence.TenantDiscriminator;
....

@Entity(name = "test_A")
@Multitenant(tenantDiscriminators = { @TenantDiscriminator(columnName = "tenant") })
@Indexes({ @Index(columnNames = { "field1", "field2" }, unique = false) })
public class A {

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
....


The code should be this:

 */
@Entity(name = "test_A")
@org.eclipse.persistence.annotations.Multitenant 
@org.eclipse.persistence.annotations.TenantDiscriminatorColumn(name = "tenant") 
@Indexes({ @Index(columnNames = { "field1", "field2" }, unique = false) })
public class A {
.....
Re: [Texo] Generation Code [message #986399 is a reply to message #986391] Tue, 20 November 2012 10:27 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Gabriele,
Okay thanks, will check and solve it. The reason that these errors occur is that the Texo annotations model is generated
from the orm xsd (xml schema), there are slight differences between the naming/formatting/structure of the xsd compared
to the java/JPA annotations. In addition the xsd is a combination of standard JPA and eclipselink specific annotations.

gr. Martin

On 11/20/2012 11:14 AM, gabriele boldrin wrote:
> I have found other errors.
>
>
> Annotation Multitenant
> The imports are wrong, but this time the generation of annotations is incorrect
> See you http://wiki.eclipse.org/EclipseLink/Examples/JPA/Multitenant
>
> Example:
>
>
> package test;
>
> ...
> import javax.persistence.Multitenant;
> import javax.persistence.TenantDiscriminator;
> ....
>
> @Entity(name = "test_A")
> @Multitenant(tenantDiscriminators = { @TenantDiscriminator(columnName = "tenant") })
> @Indexes({ @Index(columnNames = { "field1", "field2" }, unique = false) })
> public class A {
>
> /**
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> * ....
>
>
> The code should be this:
>
>
> */
> @Entity(name = "test_A")
> @org.eclipse.persistence.annotations.Multitenant @org.eclipse.persistence.annotations.TenantDiscriminatorColumn(name =
> "tenant") @Indexes({ @Index(columnNames = { "field1", "field2" }, unique = false) })
> public class A {
> .....
>


--

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:File goes dirty when existing item selected
Next Topic:Re-Generation orm annotation file
Goto Forum:
  


Current Time: Mon Dec 22 03:46:04 GMT 2014

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

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