Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo: problems with HibernatePersistableEList.equal(Object)
Teneo: problems with HibernatePersistableEList.equal(Object) [message #63684] Tue, 05 December 2006 07:57 Go to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
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 #63753 is a reply to message #63684] Tue, 05 December 2006 12:11 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
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 #63800 is a reply to message #63753] Tue, 05 December 2006 14:05 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
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 12:11 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
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 14:05 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
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
>
>
Previous Topic:extending EvaluationVisitorImpl
Next Topic:Dynamic constraint provider
Goto Forum:
  


Current Time: Thu Mar 28 16:49:22 GMT 2024

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

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

Back to the top