[Teneo/EclipseLink] @Embeddable support [message #515289] |
Thu, 18 February 2010 11:15 |
|
Is the @Embeddable annotation supported by Teneo/EclipseLInk?
I've annotated a class with teneo.jpa annotation @Embeddable and containment a reference to it with teneo.jpa @Embedded.
However in the generated ORM I only see the reference:
<entity ...>
<embedded name="contact"/>
</entity>
and I can't find an <embeddable class="...Contact"/>
any ideas?
Assen.
|
|
|
|
Re: [Teneo/EclipseLink] @Embeddable support [message #515353 is a reply to message #515333] |
Thu, 18 February 2010 14:52 |
|
Hi Martin,
It looks more like a missing feature. I'll enter a bugzilla for this one, and for another one I found..
In the meantime, I'll share a possible solution:
1. Create an EClass ( the one that will be embedded - ex. Address)
2. Annotate the embeddable EClass with teneo.jpa: value -> @Embeddable - this will make the ORM generator to skip generation for entity mapping for this class.
3. Create an EDataType whose instance type name is the generated embeddable EClass implementation (ex. AddressImpl, call it EmbeddableAddress)
4. In the EClass that will have the embedded EClass, add a new child EAttribute whose EType is the EDataType from point 3 (EmbeddableAddress).
5. Manually add an <embedded /> attribute to the ORM mapping of the class from point 4.
6. Manually add the <embeddable /> element for the EClass implementation of the embeddable EClass.
This workaround may not be the best solution, but it appears to work as expected..
I was not able to use reference (EClass -> Embeddable EEClass) in the model, because the <embeddable /> mapping requires a class name, while the reference is declared with the interface of the embeddable class. I was wondering if there's a way to force the EMF model generator to suppress the interface generation on a given EClass only. Do you know?
Cheers,
Assen.
|
|
|
Powered by
FUDForum. Page generated in 0.02405 seconds