Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo][CDO-Hibernate] How to access the EMF type of a CDOFeature server-side (CUSTOM data type prob
[Teneo][CDO-Hibernate] How to access the EMF type of a CDOFeature server-side (CUSTOM data type prob [message #617904] Thu, 24 April 2008 17:50
Eric is currently offline EricFriend
Messages: 40
Registered: July 2009
Member
Hi Martin, Eike,

I want to solve a problem I have with custom CDO types. To summarize
my problem, I have an EMF type with an attribute of type byte[] and
using Teneo's annotation, I've mapped it to a binary blob. When the
CDOPropertyGetter returns the value, it is returning a String and this
is causing a ClassCastException. So to fix this problem, I'd like to do
the following:

In CDOPropertyGetter:
public Object get(Object target) throws HibernateException
{
InternalCDORevision revision = (InternalCDORevision)target;
Object value = revision.getValue(getCDOFeature());
if(getCDOFeature().getType() == CDOType.CUSTOM)
return EcoreUtil.convertFromString(..., value);
return value;
}

where ... would be replaced by the EMF data type.

Another solution would be to create a CDOCustomPropertyGetter and have
the CDORevisionTuplizer instantiate it by passing it the concrete EMF
data type and this CDOCustomPropertyGetter would do the conversion.
This solution would remove the if statement from my code above.

Anyhow, there is no unique solution to this problem, but they all
require access to the original EMF type... How can I get it?

Thanks,
Eric
Previous Topic:Re: Emfatic
Next Topic:[Ecore Tools] Treerouter for inheritance relationships?
Goto Forum:
  


Current Time: Tue Apr 07 05:14:26 GMT 2020

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

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

Back to the top