Skip to main content
Jump to: navigation, search

Difference between revisions of "Texo/ORM JPA Annotations Details"

(Introduction)
(Introduction)
Line 3: Line 3:
 
== Introduction ==
 
== Introduction ==
  
The Texo ORM generation can be controlled completely through an [[Texo/Code_Generation_Details#What_is_an_Annotations_Model|annotations model]]. Texo supports the ORM 2.0 standard. The ORM/JPA model annotations make it possible to override/set all ORM 2.0 annotations at model level. You only need to annotate the parts of the model which need extra attention. Texo will automatically add any missing annotations to get to a fully annotated model (while maintaining the manual settings).
+
The Texo ORM generation can be controlled completely through an [[Texo/Code_Generation_Details#What_is_an_Annotations_Model|annotations model]]. The Texo ORM annotation model is directly based on the [[http://wiki.eclipse.org/EclipseLink/XSDs|ORM 2.0 standard]]. The ORM/JPA model annotations make it possible to override/set all ORM 2.0 annotations at model level. You only need to annotate the parts of the model which need extra attention. Texo will automatically add any missing annotations to get to a fully annotated model (while maintaining the manual settings).
  
 
== Maintaining ORM model annotations ==
 
== Maintaining ORM model annotations ==

Revision as of 17:34, 17 May 2010

Introduction

The Texo ORM generation can be controlled completely through an annotations model. The Texo ORM annotation model is directly based on the [2.0 standard]. The ORM/JPA model annotations make it possible to override/set all ORM 2.0 annotations at model level. You only need to annotate the parts of the model which need extra attention. Texo will automatically add any missing annotations to get to a fully annotated model (while maintaining the manual settings).

Maintaining ORM model annotations

The initial ORM annotations model can be created in the same way as described for code generation, see here. You start with an empty annotation model and create the nodes in the annotations model to add ORM annotations.


Org.eclipse.emf.texo.orm.annotations.model.png


You can add ORM Annotations at each level of your model: EPackage, EClass, EAttribute, EReference and EDataType. By right clicking on an ORM Annotation node you can see which ORM specific annotations can be added:


Org.eclipse.emf.texo.adding.orm.annotation.png


And ORM specific annotations can again have children:


Org.eclipse.emf.texo.adding.orm.annotation2.png


Note: it is possible to specify ORM annotations on an EDataType, these annotations are copied to each EAttribute using that EDataType.

Texo Mapping Decisions

Texo makes the following mapping decisions when generating an orm.xml:

  • as a default all access is set at FIELD (this in contrast to the JPA default which is PROPERTY), only interfaces will use the PROPERTY access type.
  • join tables are named as: entityname_efeaturename. This in contrast to the JPA default which specifies that a join table should be the concatenation of the names of the 2 tables which are joined. Texo uses a different approach as it provides a more robust naming without collisions.
  • Texo will automatically manage which side is the owner in a bi-directional association.
  • Texo chooses the entity name (is the same as the EClass name).

Future extensions

  • Support the Map type
  • Generate more database schema constructs in the orm.xml (column names for example).
  • Make the database artifact/entity naming logic configurable

Back to the top