Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] comparison byte[] with Byte[]
[Teneo] comparison byte[] with Byte[] [message #98914] Wed, 10 October 2007 15:35 Go to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi,

I am not sure if this can be solved at emf-teneo level or lies with
hibernate.
We have a binary attribute.
In emf core attribute type is EByteArray [byte[]] and in hibernate file
array has byte element type i.e. <element type="byte"/>.

Data is saved and retrieved fine.

But only thing is that when hibernate looks for changes it compares
btye[] with Byte[]. Though contents are same that result in treating it
as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method compares
"currentState" as byte [ ] with "previousState" as Byte[ ].


So everytime data is loaded, this one is always marked dirty.

Is there some way around this?

Thanks.
- Parvez
Re: [Teneo] comparison byte[] with Byte[] [message #99048 is a reply to message #98914] Thu, 11 October 2007 07:05 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Parvez,
Just two ideas:
1) change the type used in emf (I am not sure if this is possible in your case, probably this is
something you already thought of)
2) create your own hibernate usertype which is used to persist this efeature. You can try to find
out which type is used by hibernate (subclass of org.hibernate.type.Type) and override that class
and its isDirty methods.
Your type can then be set in an annotation in the efeature (see hibernate typedef and type annotations).

gr. Martin

PC wrote:
> Hi,
>
> I am not sure if this can be solved at emf-teneo level or lies with
> hibernate.
> We have a binary attribute.
> In emf core attribute type is EByteArray [byte[]] and in hibernate file
> array has byte element type i.e. <element type="byte"/>.
>
> Data is saved and retrieved fine.
>
> But only thing is that when hibernate looks for changes it compares
> btye[] with Byte[]. Though contents are same that result in treating it
> as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method compares
> "currentState" as byte [ ] with "previousState" as Byte[ ].
>
>
> So everytime data is loaded, this one is always marked dirty.
>
> Is there some way around this?
>
> Thanks.
> - Parvez


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] comparison byte[] with Byte[] [message #100355 is a reply to message #99048] Tue, 30 October 2007 17:40 Go to previous messageGo to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Martin,

That has been resolved by changing array to property i.e.

Earlier it was <array> </array> containing type as <element type="byte"/>

Now changed to property, which is working fine i.e.


<property name="data" lazy="false" insert="true" update="true"
not-null="true" unique="false" type="binary">
<column not-null="false" unique="false"
name="`librarydata_data_id`"/>
</property>

Thanks.
- Parvez

Martin Taal wrote:
> Hi Parvez,
> Just two ideas:
> 1) change the type used in emf (I am not sure if this is possible in
> your case, probably this is something you already thought of)
> 2) create your own hibernate usertype which is used to persist this
> efeature. You can try to find out which type is used by hibernate
> (subclass of org.hibernate.type.Type) and override that class and its
> isDirty methods.
> Your type can then be set in an annotation in the efeature (see
> hibernate typedef and type annotations).
>
> gr. Martin
>
> PC wrote:
>> Hi,
>>
>> I am not sure if this can be solved at emf-teneo level or lies with
>> hibernate.
>> We have a binary attribute.
>> In emf core attribute type is EByteArray [byte[]] and in hibernate
>> file array has byte element type i.e. <element type="byte"/>.
>>
>> Data is saved and retrieved fine.
>>
>> But only thing is that when hibernate looks for changes it compares
>> btye[] with Byte[]. Though contents are same that result in treating
>> it as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method
>> compares "currentState" as byte [ ] with "previousState" as Byte[ ].
>>
>>
>> So everytime data is loaded, this one is always marked dirty.
>>
>> Is there some way around this?
>>
>> Thanks.
>> - Parvez
>
>
Re: [Teneo] comparison byte[] with Byte[] [message #100384 is a reply to message #100355] Wed, 31 October 2007 08:03 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Parvez,
Thanks for the update, good to know that this also works. I will consider this also as a mapping for
byte arrays (maybe driven by an option).

gr. Martin

PC wrote:
> Hi Martin,
>
> That has been resolved by changing array to property i.e.
>
> Earlier it was <array> </array> containing type as <element type="byte"/>
>
> Now changed to property, which is working fine i.e.
>
>
> <property name="data" lazy="false" insert="true" update="true"
> not-null="true" unique="false" type="binary">
> <column not-null="false" unique="false"
> name="`librarydata_data_id`"/>
> </property>
>
> Thanks.
> - Parvez
>
> Martin Taal wrote:
>> Hi Parvez,
>> Just two ideas:
>> 1) change the type used in emf (I am not sure if this is possible in
>> your case, probably this is something you already thought of)
>> 2) create your own hibernate usertype which is used to persist this
>> efeature. You can try to find out which type is used by hibernate
>> (subclass of org.hibernate.type.Type) and override that class and its
>> isDirty methods.
>> Your type can then be set in an annotation in the efeature (see
>> hibernate typedef and type annotations).
>>
>> gr. Martin
>>
>> PC wrote:
>>> Hi,
>>>
>>> I am not sure if this can be solved at emf-teneo level or lies with
>>> hibernate.
>>> We have a binary attribute.
>>> In emf core attribute type is EByteArray [byte[]] and in hibernate
>>> file array has byte element type i.e. <element type="byte"/>.
>>>
>>> Data is saved and retrieved fine.
>>>
>>> But only thing is that when hibernate looks for changes it compares
>>> btye[] with Byte[]. Though contents are same that result in treating
>>> it as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method
>>> compares "currentState" as byte [ ] with "previousState" as Byte[ ].
>>>
>>>
>>> So everytime data is loaded, this one is always marked dirty.
>>>
>>> Is there some way around this?
>>>
>>> Thanks.
>>> - Parvez
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] comparison byte[] with Byte[] [message #609992 is a reply to message #98914] Thu, 11 October 2007 07:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Parvez,
Just two ideas:
1) change the type used in emf (I am not sure if this is possible in your case, probably this is
something you already thought of)
2) create your own hibernate usertype which is used to persist this efeature. You can try to find
out which type is used by hibernate (subclass of org.hibernate.type.Type) and override that class
and its isDirty methods.
Your type can then be set in an annotation in the efeature (see hibernate typedef and type annotations).

gr. Martin

PC wrote:
> Hi,
>
> I am not sure if this can be solved at emf-teneo level or lies with
> hibernate.
> We have a binary attribute.
> In emf core attribute type is EByteArray [byte[]] and in hibernate file
> array has byte element type i.e. <element type="byte"/>.
>
> Data is saved and retrieved fine.
>
> But only thing is that when hibernate looks for changes it compares
> btye[] with Byte[]. Though contents are same that result in treating it
> as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method compares
> "currentState" as byte [ ] with "previousState" as Byte[ ].
>
>
> So everytime data is loaded, this one is always marked dirty.
>
> Is there some way around this?
>
> Thanks.
> - Parvez


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] comparison byte[] with Byte[] [message #610173 is a reply to message #99048] Tue, 30 October 2007 17:40 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Martin,

That has been resolved by changing array to property i.e.

Earlier it was <array> </array> containing type as <element type="byte"/>

Now changed to property, which is working fine i.e.


<property name="data" lazy="false" insert="true" update="true"
not-null="true" unique="false" type="binary">
<column not-null="false" unique="false"
name="`librarydata_data_id`"/>
</property>

Thanks.
- Parvez

Martin Taal wrote:
> Hi Parvez,
> Just two ideas:
> 1) change the type used in emf (I am not sure if this is possible in
> your case, probably this is something you already thought of)
> 2) create your own hibernate usertype which is used to persist this
> efeature. You can try to find out which type is used by hibernate
> (subclass of org.hibernate.type.Type) and override that class and its
> isDirty methods.
> Your type can then be set in an annotation in the efeature (see
> hibernate typedef and type annotations).
>
> gr. Martin
>
> PC wrote:
>> Hi,
>>
>> I am not sure if this can be solved at emf-teneo level or lies with
>> hibernate.
>> We have a binary attribute.
>> In emf core attribute type is EByteArray [byte[]] and in hibernate
>> file array has byte element type i.e. <element type="byte"/>.
>>
>> Data is saved and retrieved fine.
>>
>> But only thing is that when hibernate looks for changes it compares
>> btye[] with Byte[]. Though contents are same that result in treating
>> it as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method
>> compares "currentState" as byte [ ] with "previousState" as Byte[ ].
>>
>>
>> So everytime data is loaded, this one is always marked dirty.
>>
>> Is there some way around this?
>>
>> Thanks.
>> - Parvez
>
>
Re: [Teneo] comparison byte[] with Byte[] [message #610177 is a reply to message #100355] Wed, 31 October 2007 08:03 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Parvez,
Thanks for the update, good to know that this also works. I will consider this also as a mapping for
byte arrays (maybe driven by an option).

gr. Martin

PC wrote:
> Hi Martin,
>
> That has been resolved by changing array to property i.e.
>
> Earlier it was <array> </array> containing type as <element type="byte"/>
>
> Now changed to property, which is working fine i.e.
>
>
> <property name="data" lazy="false" insert="true" update="true"
> not-null="true" unique="false" type="binary">
> <column not-null="false" unique="false"
> name="`librarydata_data_id`"/>
> </property>
>
> Thanks.
> - Parvez
>
> Martin Taal wrote:
>> Hi Parvez,
>> Just two ideas:
>> 1) change the type used in emf (I am not sure if this is possible in
>> your case, probably this is something you already thought of)
>> 2) create your own hibernate usertype which is used to persist this
>> efeature. You can try to find out which type is used by hibernate
>> (subclass of org.hibernate.type.Type) and override that class and its
>> isDirty methods.
>> Your type can then be set in an annotation in the efeature (see
>> hibernate typedef and type annotations).
>>
>> gr. Martin
>>
>> PC wrote:
>>> Hi,
>>>
>>> I am not sure if this can be solved at emf-teneo level or lies with
>>> hibernate.
>>> We have a binary attribute.
>>> In emf core attribute type is EByteArray [byte[]] and in hibernate
>>> file array has byte element type i.e. <element type="byte"/>.
>>>
>>> Data is saved and retrieved fine.
>>>
>>> But only thing is that when hibernate looks for changes it compares
>>> btye[] with Byte[]. Though contents are same that result in treating
>>> it as dirty i.e. org.hibernate.type.TypeFactory.findDirty() method
>>> compares "currentState" as byte [ ] with "previousState" as Byte[ ].
>>>
>>>
>>> So everytime data is loaded, this one is always marked dirty.
>>>
>>> Is there some way around this?
>>>
>>> Thanks.
>>> - Parvez
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:[Teneo]foreign key element in jdo not generated properly?
Next Topic:[Teneo]foreign key element in jdo not generated properly?
Goto Forum:
  


Current Time: Thu Apr 25 01:35:36 GMT 2024

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

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

Back to the top