Archive for December 2011
Recently I have spend some time adding some nice new features to Teneo:
- I made it easier to persist references to EObjects as varchars (URI), i.e. as external references
- it is now possible to persist EObjects as hibernate user types/simple types
Teneo for a while already had the possibility to store external references as a string in the database. The URI to the object is persisted in this case. This makes it possible to persist part of your model in an XML file and part in the database. When reading objects from the database the references to the objects in XML are automatically handled/resolved.
I now made it a bit easier to work with these External references. You can now annotate an EClass with the @External annotation (as an EAnnotation). This gives you:
- each EReference to this EClass is assumed to be external, the URI of the referenced object is stored in a VARCHAR column
- no table is created for the externalized EClass
Ofcourse you can still also annotated individual EReferences with @External, the EClass and EReference annotations can be used next to eachother.
Another nice addition is the ability to store an EObject as a Hibernate user type. Before it was only possible to store values of EAttributes using a Hibernate user type. The latest Teneo build now makes it possible to annotate an EReference or an EClass with the @Type annotation. If the EClass is annotated then all EReferences to this EClass will be persisted as a hibernate user type and the EClass will not have its own table.
The @Type annotation has a type attribute which should contain the full classname of the hibernate user type implementation. For an ecore example with several examples of the user type annotation, check out this ecore model (See the Name EDataType and the Certificate EClass for specific annotations).
Texo is an EMF variant which provides real pojo/JPA entity generation from ecore/xsd models.
The main difference with EMF is that the generated code does not contain any framework specific constructs. The code can be serialized, persisted etc. in standard frameworks (EclipseLink, Hibernate, GWT) without additional layers. This in contrast to EMF which for example requires a solution like Teneo at runtime to take care of persistence in Hibernate.
Still, eventhough Texo follows a different solution path than EMF, much of the same functionality is supported:
- XML/XMI serialization
- supports for many XSD constructs (xsd:choice for example)
- runtime model access
- safe bi-directional associations
- supports manual changes in generated code (same pattern as EMF)
Different from EMF, Texo supports this functionality by externalizing the framework specific constructs in separate generated (optional) classes. The generated entities are not ‘polluted’ with framework constructs.
In addition to the above Texo also adds new features not provided by EMF:
- generation of JPA annotated code (with manual merging)
- flexible code generation (extendable, support for list/set, etc.)
- java annotations from model to code
Texo is targeted at the server side of web server/service environments. The current development focuses on extending the Texo runtime with generated REST XML/XMI webservices.