Teneo: problems with HibernatePersistableEList.equal(Object) [message #63684] |
Tue, 05 December 2006 02:57  |
Eclipse User |
|
|
|
Hi all.
When I have some feature in my model which is unordered list it's mapped
as <bag> so in runtime I have HibernatePersistableEList which delegates
to hibernate PersistentBag class. The problem is that PersistantBag
equals() method is:
/**
* Bag does not respect the collection API and do an
* JVM instance comparison to do the equals.
* The semantic is broken not to have to initialize a
* collection for a simple equals() operation.
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
return super.equals(obj);
}
So when I try to compare two features which are
HibernatePersistableLists in runtime I get annoying result.
More: HibernatePersistableList delegating to PersistentBag is not equal
to itself. Why? Cause HibernatePersistableList extends DelegatingEList
that has:
public boolean equals(Object object)
{
return delegateEquals(object);
}
protected boolean delegateEquals(Object object)
{
return delegateList().equals(object);
}
Imagine that you have HibernatePersistableList myList.
myList.equals(myList) return always false cause calling to equals
results in comparison
persistentBagDelegate.equals(myList).
BUT HERE IS INSTANCE COMPARISON - SO IT RETURNS FALSE.
Is there any simple workaround or can Teneo implements correct equals()
method in PersistableLists?
Thanks in advance
|
|
|
|
Re: Teneo: problems with HibernatePersistableEList.equal(Object) [message #63800 is a reply to message #63753] |
Tue, 05 December 2006 09:05  |
Eclipse User |
|
|
|
I have created issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166778
Will wait for fix
Thanks
Martin Taal wrote:
> Hi Ilya,
> As the hibernate remark says it can make sense to do jvm instance
> comparison for the HibernatePersistableEList (because of lazy loading
> etc.).
>
> Can you enter a bugzilla for this change (it means that this change is
> visible in the release notes later)?
>
> gr. Martin
>
> Ilya Klyuchnikov wrote:
>> Hi all.
>>
>> When I have some feature in my model which is unordered list it's
>> mapped as <bag> so in runtime I have HibernatePersistableEList which
>> delegates to hibernate PersistentBag class. The problem is that
>> PersistantBag equals() method is:
>>
>> /**
>> * Bag does not respect the collection API and do an
>> * JVM instance comparison to do the equals.
>> * The semantic is broken not to have to initialize a
>> * collection for a simple equals() operation.
>> * @see java.lang.Object#equals(java.lang.Object)
>> */
>> public boolean equals(Object obj) {
>> return super.equals(obj);
>> }
>>
>> So when I try to compare two features which are
>> HibernatePersistableLists in runtime I get annoying result.
>>
>> More: HibernatePersistableList delegating to PersistentBag is not
>> equal to itself. Why? Cause HibernatePersistableList extends
>> DelegatingEList that has:
>>
>> public boolean equals(Object object)
>> {
>> return delegateEquals(object);
>> }
>>
>> protected boolean delegateEquals(Object object)
>> {
>> return delegateList().equals(object);
>> }
>>
>> Imagine that you have HibernatePersistableList myList.
>> myList.equals(myList) return always false cause calling to equals
>> results in comparison
>>
>> persistentBagDelegate.equals(myList).
>>
>> BUT HERE IS INSTANCE COMPARISON - SO IT RETURNS FALSE.
>>
>> Is there any simple workaround or can Teneo implements correct
>> equals() method in PersistableLists?
>>
>> Thanks in advance
>
>
|
|
|
Re: Teneo: problems with HibernatePersistableEList.equal(Object) [message #596530 is a reply to message #63684] |
Tue, 05 December 2006 07:11  |
Eclipse User |
|
|
|
Hi Ilya,
As the hibernate remark says it can make sense to do jvm instance comparison for the
HibernatePersistableEList (because of lazy loading etc.).
Can you enter a bugzilla for this change (it means that this change is visible in the release notes
later)?
gr. Martin
Ilya Klyuchnikov wrote:
> Hi all.
>
> When I have some feature in my model which is unordered list it's mapped
> as <bag> so in runtime I have HibernatePersistableEList which delegates
> to hibernate PersistentBag class. The problem is that PersistantBag
> equals() method is:
>
> /**
> * Bag does not respect the collection API and do an
> * JVM instance comparison to do the equals.
> * The semantic is broken not to have to initialize a
> * collection for a simple equals() operation.
> * @see java.lang.Object#equals(java.lang.Object)
> */
> public boolean equals(Object obj) {
> return super.equals(obj);
> }
>
> So when I try to compare two features which are
> HibernatePersistableLists in runtime I get annoying result.
>
> More: HibernatePersistableList delegating to PersistentBag is not equal
> to itself. Why? Cause HibernatePersistableList extends DelegatingEList
> that has:
>
> public boolean equals(Object object)
> {
> return delegateEquals(object);
> }
>
> protected boolean delegateEquals(Object object)
> {
> return delegateList().equals(object);
> }
>
> Imagine that you have HibernatePersistableList myList.
> myList.equals(myList) return always false cause calling to equals
> results in comparison
>
> persistentBagDelegate.equals(myList).
>
> BUT HERE IS INSTANCE COMPARISON - SO IT RETURNS FALSE.
>
> Is there any simple workaround or can Teneo implements correct equals()
> method in PersistableLists?
>
> Thanks in advance
--
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: problems with HibernatePersistableEList.equal(Object) [message #596550 is a reply to message #63753] |
Tue, 05 December 2006 09:05  |
Eclipse User |
|
|
|
I have created issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166778
Will wait for fix
Thanks
Martin Taal wrote:
> Hi Ilya,
> As the hibernate remark says it can make sense to do jvm instance
> comparison for the HibernatePersistableEList (because of lazy loading
> etc.).
>
> Can you enter a bugzilla for this change (it means that this change is
> visible in the release notes later)?
>
> gr. Martin
>
> Ilya Klyuchnikov wrote:
>> Hi all.
>>
>> When I have some feature in my model which is unordered list it's
>> mapped as <bag> so in runtime I have HibernatePersistableEList which
>> delegates to hibernate PersistentBag class. The problem is that
>> PersistantBag equals() method is:
>>
>> /**
>> * Bag does not respect the collection API and do an
>> * JVM instance comparison to do the equals.
>> * The semantic is broken not to have to initialize a
>> * collection for a simple equals() operation.
>> * @see java.lang.Object#equals(java.lang.Object)
>> */
>> public boolean equals(Object obj) {
>> return super.equals(obj);
>> }
>>
>> So when I try to compare two features which are
>> HibernatePersistableLists in runtime I get annoying result.
>>
>> More: HibernatePersistableList delegating to PersistentBag is not
>> equal to itself. Why? Cause HibernatePersistableList extends
>> DelegatingEList that has:
>>
>> public boolean equals(Object object)
>> {
>> return delegateEquals(object);
>> }
>>
>> protected boolean delegateEquals(Object object)
>> {
>> return delegateList().equals(object);
>> }
>>
>> Imagine that you have HibernatePersistableList myList.
>> myList.equals(myList) return always false cause calling to equals
>> results in comparison
>>
>> persistentBagDelegate.equals(myList).
>>
>> BUT HERE IS INSTANCE COMPARISON - SO IT RETURNS FALSE.
>>
>> Is there any simple workaround or can Teneo implements correct
>> equals() method in PersistableLists?
>>
>> Thanks in advance
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03208 seconds