Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Teneo: storing custom EDataType attributes (i.e. java.io.File)
Teneo: storing custom EDataType attributes (i.e. java.io.File) [message #52269] |
Sun, 24 September 2006 14:50 |
Eclipse User |
|
|
|
Originally posted by: ChrisHines.msn.com
Hi,
I've been experimenting with Teneo and EMF for one of my projects. So far
I'm very impressed. I have run into a problem though. I have a model with
some custom EDataType definitions. Specifically, I have created an
EDataType for java.io.File.
<eClassifiers xsi:type="ecore:EDataType" name="JavaFile"
instanceClassName="java.io.File"/>
I use this data type as an attribute type in one of my model classes that I
would like to persist using Teneo with Hibernate. Allowing Teneo to build
the Hibernate mapping file, I discovered that they define the column type as
a binary type. I would like to persist the File object as a string. Is
there an annotation I can use to achieve this goal?
In an effort to work around the above challenge I defined an additional
attribute on my model class. The new attribute has type EString. My idea
was to make the new attribute a derived String reflection of the File
attribute and make the file attribute transient. The hope was that the
application would use the File API for logic and Teneo would use the String
API for persistence. I defined the String attribute as not-changeable,
volatile, and derived. I defined the File attribute as transient. The
result was that Teneo didn't store either attribute, claiming they were both
transient. When I removed the volatile setting from the String attribute it
was persisted, but now I have duplicate memory use in my object. So
question #2 is: how does Teneo determine that an attribute is volatile
(since the ECore volatile setting does not seem to be the sole criteria).
Thanks,
Chris
|
|
|
Re: Teneo: storing custom EDataType attributes (i.e. java.io.File) [message #52295 is a reply to message #52269] |
Sun, 24 September 2006 19:19 |
Eclipse User |
|
|
|
Originally posted by: reverse.moc.eliga.gnittib.salguod
Use the @Type(type="java.class.here") annotation, where
"java.class.here" is your implementation of Hibernate's UserType
interface; if you're using the old style annotations, the source is
"http://hibernate.elver.org/Type". You can stick this annotation on the
JavaFile EDataType, and then it will be used everywhere an attribute is
of type JavaFile.
Cheers,
--Doug
Chris Hines wrote:
> Hi,
>
> I've been experimenting with Teneo and EMF for one of my projects. So far
> I'm very impressed. I have run into a problem though. I have a model with
> some custom EDataType definitions. Specifically, I have created an
> EDataType for java.io.File.
>
> <eClassifiers xsi:type="ecore:EDataType" name="JavaFile"
> instanceClassName="java.io.File"/>
>
> I use this data type as an attribute type in one of my model classes that I
> would like to persist using Teneo with Hibernate. Allowing Teneo to build
> the Hibernate mapping file, I discovered that they define the column type as
> a binary type. I would like to persist the File object as a string. Is
> there an annotation I can use to achieve this goal?
>
> In an effort to work around the above challenge I defined an additional
> attribute on my model class. The new attribute has type EString. My idea
> was to make the new attribute a derived String reflection of the File
> attribute and make the file attribute transient. The hope was that the
> application would use the File API for logic and Teneo would use the String
> API for persistence. I defined the String attribute as not-changeable,
> volatile, and derived. I defined the File attribute as transient. The
> result was that Teneo didn't store either attribute, claiming they were both
> transient. When I removed the volatile setting from the String attribute it
> was persisted, but now I have duplicate memory use in my object. So
> question #2 is: how does Teneo determine that an attribute is volatile
> (since the ECore volatile setting does not seem to be the sole criteria).
>
> Thanks,
> Chris
>
>
>
|
|
|
Re: Teneo: storing custom EDataType attributes (i.e. java.io.File) [message #52321 is a reply to message #52295] |
Mon, 25 September 2006 01:53 |
Eclipse User |
|
|
|
Originally posted by: ChrisHines.msn.com
Thanks Doug, I'll give that a try.
Chris
"Doug Bitting" <reverse.moc.eliga@gnittib.salguod> wrote in message
news:ef6lni$cjc$1@utils.eclipse.org...
> Use the @Type(type="java.class.here") annotation, where "java.class.here"
> is your implementation of Hibernate's UserType interface; if you're using
> the old style annotations, the source is
> "http://hibernate.elver.org/Type". You can stick this annotation on the
> JavaFile EDataType, and then it will be used everywhere an attribute is of
> type JavaFile.
>
> Cheers,
> --Doug
>
> Chris Hines wrote:
>> Hi,
>>
>> I've been experimenting with Teneo and EMF for one of my projects. So
>> far I'm very impressed. I have run into a problem though. I have a
>> model with some custom EDataType definitions. Specifically, I have
>> created an EDataType for java.io.File.
>>
>> <eClassifiers xsi:type="ecore:EDataType" name="JavaFile"
>> instanceClassName="java.io.File"/>
>>
>> I use this data type as an attribute type in one of my model classes that
>> I would like to persist using Teneo with Hibernate. Allowing Teneo to
>> build the Hibernate mapping file, I discovered that they define the
>> column type as a binary type. I would like to persist the File object as
>> a string. Is there an annotation I can use to achieve this goal?
>>
>> In an effort to work around the above challenge I defined an additional
>> attribute on my model class. The new attribute has type EString. My
>> idea was to make the new attribute a derived String reflection of the
>> File attribute and make the file attribute transient. The hope was that
>> the application would use the File API for logic and Teneo would use the
>> String API for persistence. I defined the String attribute as
>> not-changeable, volatile, and derived. I defined the File attribute as
>> transient. The result was that Teneo didn't store either attribute,
>> claiming they were both transient. When I removed the volatile setting
>> from the String attribute it was persisted, but now I have duplicate
>> memory use in my object. So question #2 is: how does Teneo determine
>> that an attribute is volatile (since the ECore volatile setting does not
>> seem to be the sole criteria).
>>
>> Thanks,
>> Chris
>>
>>
|
|
|
Re: Teneo: storing custom EDataType attributes (i.e. java.io.File) [message #591839 is a reply to message #52269] |
Sun, 24 September 2006 19:19 |
Eclipse User |
|
|
|
Originally posted by: reverse.moc.eliga.gnittib.salguod
Use the @Type(type="java.class.here") annotation, where
"java.class.here" is your implementation of Hibernate's UserType
interface; if you're using the old style annotations, the source is
"http://hibernate.elver.org/Type". You can stick this annotation on the
JavaFile EDataType, and then it will be used everywhere an attribute is
of type JavaFile.
Cheers,
--Doug
Chris Hines wrote:
> Hi,
>
> I've been experimenting with Teneo and EMF for one of my projects. So far
> I'm very impressed. I have run into a problem though. I have a model with
> some custom EDataType definitions. Specifically, I have created an
> EDataType for java.io.File.
>
> <eClassifiers xsi:type="ecore:EDataType" name="JavaFile"
> instanceClassName="java.io.File"/>
>
> I use this data type as an attribute type in one of my model classes that I
> would like to persist using Teneo with Hibernate. Allowing Teneo to build
> the Hibernate mapping file, I discovered that they define the column type as
> a binary type. I would like to persist the File object as a string. Is
> there an annotation I can use to achieve this goal?
>
> In an effort to work around the above challenge I defined an additional
> attribute on my model class. The new attribute has type EString. My idea
> was to make the new attribute a derived String reflection of the File
> attribute and make the file attribute transient. The hope was that the
> application would use the File API for logic and Teneo would use the String
> API for persistence. I defined the String attribute as not-changeable,
> volatile, and derived. I defined the File attribute as transient. The
> result was that Teneo didn't store either attribute, claiming they were both
> transient. When I removed the volatile setting from the String attribute it
> was persisted, but now I have duplicate memory use in my object. So
> question #2 is: how does Teneo determine that an attribute is volatile
> (since the ECore volatile setting does not seem to be the sole criteria).
>
> Thanks,
> Chris
>
>
>
|
|
|
Re: Teneo: storing custom EDataType attributes (i.e. java.io.File) [message #591848 is a reply to message #52295] |
Mon, 25 September 2006 01:53 |
Chris Hines Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Thanks Doug, I'll give that a try.
Chris
"Doug Bitting" <reverse.moc.eliga@gnittib.salguod> wrote in message
news:ef6lni$cjc$1@utils.eclipse.org...
> Use the @Type(type="java.class.here") annotation, where "java.class.here"
> is your implementation of Hibernate's UserType interface; if you're using
> the old style annotations, the source is
> "http://hibernate.elver.org/Type". You can stick this annotation on the
> JavaFile EDataType, and then it will be used everywhere an attribute is of
> type JavaFile.
>
> Cheers,
> --Doug
>
> Chris Hines wrote:
>> Hi,
>>
>> I've been experimenting with Teneo and EMF for one of my projects. So
>> far I'm very impressed. I have run into a problem though. I have a
>> model with some custom EDataType definitions. Specifically, I have
>> created an EDataType for java.io.File.
>>
>> <eClassifiers xsi:type="ecore:EDataType" name="JavaFile"
>> instanceClassName="java.io.File"/>
>>
>> I use this data type as an attribute type in one of my model classes that
>> I would like to persist using Teneo with Hibernate. Allowing Teneo to
>> build the Hibernate mapping file, I discovered that they define the
>> column type as a binary type. I would like to persist the File object as
>> a string. Is there an annotation I can use to achieve this goal?
>>
>> In an effort to work around the above challenge I defined an additional
>> attribute on my model class. The new attribute has type EString. My
>> idea was to make the new attribute a derived String reflection of the
>> File attribute and make the file attribute transient. The hope was that
>> the application would use the File API for logic and Teneo would use the
>> String API for persistence. I defined the String attribute as
>> not-changeable, volatile, and derived. I defined the File attribute as
>> transient. The result was that Teneo didn't store either attribute,
>> claiming they were both transient. When I removed the volatile setting
>> from the String attribute it was persisted, but now I have duplicate
>> memory use in my object. So question #2 is: how does Teneo determine
>> that an attribute is volatile (since the ECore volatile setting does not
>> seem to be the sole criteria).
>>
>> Thanks,
>> Chris
>>
>>
|
|
|
Goto Forum:
Current Time: Thu Dec 26 13:21:53 GMT 2024
Powered by FUDForum. Page generated in 0.02867 seconds
|