[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 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
|
|
|
Powered by
FUDForum. Page generated in 0.02715 seconds