Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO Teneo] Do not set your version attribute to negative default
[CDO Teneo] Do not set your version attribute to negative default [message #530396] Thu, 29 April 2010 14:49 Go to next message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
Probably not worth a special case in the code, but will post here
because it might help someone . I have persistent class with version
attribute, which is located in mapped superclass. Default for this
attribute was -1 for some reason, which caused mysterious exception:

[ERROR] Rollback in HibernateStore: java.lang.IllegalStateException:
Revision was not registered:
GeneralVars@OID:http:///si/arso/meteo.ecore#GeneralVars#3000 00048:0v0
at
org.eclipse.emf.cdo.internal.server.TransactionCommitContext .addRevisions(TransactionCommitContext.java:728)
at
org.eclipse.emf.cdo.internal.server.TransactionCommitContext .updateInfraStructure(TransactionCommitContext.java:669)
at
org.eclipse.emf.cdo.internal.server.TransactionCommitContext .commit(TransactionCommitContext.java:316)
at
org.eclipse.emf.cdo.spi.server.InternalCommitContext$2.runLo op(InternalCommitContext.java:45)
at
org.eclipse.emf.cdo.spi.server.InternalCommitContext$2.runLo op(InternalCommitContext.java:1)
at
org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at
org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicatingCommit(CommitTransactionIndicat ion.java:266)
at
org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:162)
at
org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:116)
at
org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
at
org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
at
org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

After setting default to 0, everything works.

Root cause is in CdoRevisionManagerImpl#addRevision

int oldVersion = revision.getVersion() - 1;
if (oldVersion >= CDORevision.UNSPECIFIED_VERSION) {
Re: [CDO Teneo] Do not set your version attribute to negative default [message #530411 is a reply to message #530396] Thu, 29 April 2010 15:11 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Thanks for posting Aleksander! I have added it to the troubleshooting section:
http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered

Feel free to adapt/add anyother comments there.

gr. Martin

Aleksander Bandelj wrote:
> Probably not worth a special case in the code, but will post here
> because it might help someone . I have persistent class with version
> attribute, which is located in mapped superclass. Default for this
> attribute was -1 for some reason, which caused mysterious exception:
>
> [ERROR] Rollback in HibernateStore: java.lang.IllegalStateException:
> Revision was not registered:
> GeneralVars@OID:http:///si/arso/meteo.ecore#GeneralVars#3000 00048:0v0
> at
> org.eclipse.emf.cdo.internal.server.TransactionCommitContext .addRevisions(TransactionCommitContext.java:728)
> at
> org.eclipse.emf.cdo.internal.server.TransactionCommitContext .updateInfraStructure(TransactionCommitContext.java:669)
> at
> org.eclipse.emf.cdo.internal.server.TransactionCommitContext .commit(TransactionCommitContext.java:316)
> at
> org.eclipse.emf.cdo.spi.server.InternalCommitContext$2.runLo op(InternalCommitContext.java:45)
> at
> org.eclipse.emf.cdo.spi.server.InternalCommitContext$2.runLo op(InternalCommitContext.java:1)
> at
> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicatingCommit(CommitTransactionIndicat ion.java:266)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:162)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:116)
> at
> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
> at
> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
> at
> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
> at
> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
>
> After setting default to 0, everything works.
>
> Root cause is in CdoRevisionManagerImpl#addRevision
>
> int oldVersion = revision.getVersion() - 1;
> if (oldVersion >= CDORevision.UNSPECIFIED_VERSION) {
>
>
>
>
Th

--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: [CDO Teneo] Version column heisenbugs [message #530465 is a reply to message #530411] Thu, 29 April 2010 17:18 Go to previous messageGo to next message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
Sadly, I've discovered that's not nearly the whole story. Somehow using
version column makes CDO/Hibernate much more susceptible to "row was
already updated or deleted by other transaction" errors, which
frequently make resource unworkable until server restart. Without
version column, everything is fine. I've also noticed example model
doesn't use version column. I would put "do not use version for
CDO/Hibernate for time being" in FAQ. I've opened:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069

But I suspect such bugs might be hard to pin down, because you have
hibernate and CDO version concurrency clashing.

-a

On 04/29/2010 05:11 PM, Martin Taal wrote:
> Thanks for posting Aleksander! I have added it to the troubleshooting
> section:
> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>
>
> Feel free to adapt/add anyother comments there.
>
> gr. Martin
>
> Aleksander Bandelj wrote:
>> Probably not worth a special case in the code, but will post here
>> because it might help someone . I have persistent class with version
>> attribute, which is located in mapped superclass. Default for this
>> attribute was -1 for some reason, which caused mysterious exception:
Re: [CDO Teneo] Version column heisenbugs [message #530642 is a reply to message #530465] Fri, 30 April 2010 12:14 Go to previous messageGo to next message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
To contradict myself yet again, no, not quite.

I've discovered that CDO/Teneo adds always_version property if not
present. This property adds version columns to mapping and they are used
by Teneo/Hibernate even though not present in the model. My problem was
that version attribute was in the model, not implicitly added by Teneo.

Approach which seems to work OK is the same as in example model: no
attributes with @Version annotations in model, but added implicitly
through teneo property always_version (set by default).

Actually, proper working of CDO/Teneo depends on versioning being
present, as I discovered in HibernateStoreAccessor#write:

// first decrease the version for all dirty objects
// hibernate will increase it again
for (CDORevision revision : context.getDirtyObjects())
{
if (revision instanceof InternalCDORevision)
{
InternalCDORevision internalRevision =
(InternalCDORevision)revision;
internalRevision.setVersion(internalRevision.getVersion() - 1);
}
}


So, maybe more emphasis in documentation/FAQ that version columns are
always needed and should not be put in model. I would put it there
myself, but I am unable to log in eclipse wiki with my bugzilla user data :/

-a

On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
> Sadly, I've discovered that's not nearly the whole story. Somehow using
> version column makes CDO/Hibernate much more susceptible to "row was
> already updated or deleted by other transaction" errors, which
> frequently make resource unworkable until server restart. Without
> version column, everything is fine. I've also noticed example model
> doesn't use version column. I would put "do not use version for
> CDO/Hibernate for time being" in FAQ. I've opened:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>
> But I suspect such bugs might be hard to pin down, because you have
> hibernate and CDO version concurrency clashing.
>
> -a
>
> On 04/29/2010 05:11 PM, Martin Taal wrote:
>
>> Thanks for posting Aleksander! I have added it to the troubleshooting
>> section:
>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>
>>
>> Feel free to adapt/add anyother comments there.
>>
>> gr. Martin
>>
>> Aleksander Bandelj wrote:
>>
>>> Probably not worth a special case in the code, but will post here
>>> because it might help someone . I have persistent class with version
>>> attribute, which is located in mapped superclass. Default for this
>>> attribute was -1 for some reason, which caused mysterious exception:
>>>
>
Re: [CDO Teneo] Version column heisenbugs [message #530667 is a reply to message #530642] Fri, 30 April 2010 13:07 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Aleksander,
Actually it should be supported that the version column is explicitly modeled. But as you have noticed it is not tested
that explicitly :-(. I will re-open the issue as a trigger to look at it in more detail.

CDO requires versions to be stored therefore Teneo will always create a version column. The version can be obtained from
the CDOObject on the client also (if needed).

gr. Martin

Aleksander Bandelj wrote:
> To contradict myself yet again, no, not quite.
>
> I've discovered that CDO/Teneo adds always_version property if not
> present. This property adds version columns to mapping and they are used
> by Teneo/Hibernate even though not present in the model. My problem was
> that version attribute was in the model, not implicitly added by Teneo.
>
> Approach which seems to work OK is the same as in example model: no
> attributes with @Version annotations in model, but added implicitly
> through teneo property always_version (set by default).
>
> Actually, proper working of CDO/Teneo depends on versioning being
> present, as I discovered in HibernateStoreAccessor#write:
>
> // first decrease the version for all dirty objects
> // hibernate will increase it again
> for (CDORevision revision : context.getDirtyObjects())
> {
> if (revision instanceof InternalCDORevision)
> {
> InternalCDORevision internalRevision =
> (InternalCDORevision)revision;
> internalRevision.setVersion(internalRevision.getVersion() - 1);
> }
> }
>
>
> So, maybe more emphasis in documentation/FAQ that version columns are
> always needed and should not be put in model. I would put it there
> myself, but I am unable to log in eclipse wiki with my bugzilla user data :/
>
> -a
>
> On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
>> Sadly, I've discovered that's not nearly the whole story. Somehow using
>> version column makes CDO/Hibernate much more susceptible to "row was
>> already updated or deleted by other transaction" errors, which
>> frequently make resource unworkable until server restart. Without
>> version column, everything is fine. I've also noticed example model
>> doesn't use version column. I would put "do not use version for
>> CDO/Hibernate for time being" in FAQ. I've opened:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>>
>> But I suspect such bugs might be hard to pin down, because you have
>> hibernate and CDO version concurrency clashing.
>>
>> -a
>>
>> On 04/29/2010 05:11 PM, Martin Taal wrote:
>>
>>> Thanks for posting Aleksander! I have added it to the troubleshooting
>>> section:
>>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>>
>>>
>>> Feel free to adapt/add anyother comments there.
>>>
>>> gr. Martin
>>>
>>> Aleksander Bandelj wrote:
>>>
>>>> Probably not worth a special case in the code, but will post here
>>>> because it might help someone . I have persistent class with version
>>>> attribute, which is located in mapped superclass. Default for this
>>>> attribute was -1 for some reason, which caused mysterious exception:
>>>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: [CDO Teneo] Version column heisenbugs [message #530732 is a reply to message #530667] Fri, 30 April 2010 15:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hey Guys,

I'm not so sure whether modeled version attributes are a good idea. How
can we ensure that their values are confirming to CDO's interpretation?

And if you want to exclude certain things (like modeled versions) I
think it's better to write code that enforces the rule, not just docs ;-)

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 30.04.2010 15:07, schrieb Martin Taal:
> Hi Aleksander,
> Actually it should be supported that the version column is explicitly
> modeled. But as you have noticed it is not tested that explicitly :-(.
> I will re-open the issue as a trigger to look at it in more detail.
>
> CDO requires versions to be stored therefore Teneo will always create
> a version column. The version can be obtained from the CDOObject on
> the client also (if needed).
>
> gr. Martin
>
> Aleksander Bandelj wrote:
>> To contradict myself yet again, no, not quite.
>>
>> I've discovered that CDO/Teneo adds always_version property if not
>> present. This property adds version columns to mapping and they are used
>> by Teneo/Hibernate even though not present in the model. My problem was
>> that version attribute was in the model, not implicitly added by Teneo.
>>
>> Approach which seems to work OK is the same as in example model: no
>> attributes with @Version annotations in model, but added implicitly
>> through teneo property always_version (set by default).
>>
>> Actually, proper working of CDO/Teneo depends on versioning being
>> present, as I discovered in HibernateStoreAccessor#write:
>>
>> // first decrease the version for all dirty objects
>> // hibernate will increase it again
>> for (CDORevision revision : context.getDirtyObjects())
>> {
>> if (revision instanceof InternalCDORevision)
>> {
>> InternalCDORevision internalRevision =
>> (InternalCDORevision)revision;
>> internalRevision.setVersion(internalRevision.getVersion() -
>> 1);
>> }
>> }
>>
>>
>> So, maybe more emphasis in documentation/FAQ that version columns are
>> always needed and should not be put in model. I would put it there
>> myself, but I am unable to log in eclipse wiki with my bugzilla user
>> data :/
>>
>> -a
>>
>> On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
>>> Sadly, I've discovered that's not nearly the whole story. Somehow using
>>> version column makes CDO/Hibernate much more susceptible to "row was
>>> already updated or deleted by other transaction" errors, which
>>> frequently make resource unworkable until server restart. Without
>>> version column, everything is fine. I've also noticed example model
>>> doesn't use version column. I would put "do not use version for
>>> CDO/Hibernate for time being" in FAQ. I've opened:
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>>>
>>> But I suspect such bugs might be hard to pin down, because you have
>>> hibernate and CDO version concurrency clashing.
>>>
>>> -a
>>>
>>> On 04/29/2010 05:11 PM, Martin Taal wrote:
>>>> Thanks for posting Aleksander! I have added it to the troubleshooting
>>>> section:
>>>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>>>
>>>>
>>>>
>>>> Feel free to adapt/add anyother comments there.
>>>>
>>>> gr. Martin
>>>>
>>>> Aleksander Bandelj wrote:
>>>>> Probably not worth a special case in the code, but will post here
>>>>> because it might help someone . I have persistent class with version
>>>>> attribute, which is located in mapped superclass. Default for this
>>>>> attribute was -1 for some reason, which caused mysterious exception:
>>
>
>


Re: [CDO Teneo] Version column heisenbugs [message #530807 is a reply to message #530732] Sat, 01 May 2010 07:59 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Eike,
I am not sure either :-). One specific reason to model it explicitly is that then the version is then part of the data
when serializing to xml (and back) or for other integration scenarios. But other than that the internal CDO version
should work fine.

I have added your comment to the bugzilla so that I won't overlook it when looking at the issue.

gr. Martin

Eike Stepper wrote:
> Hey Guys,
>
> I'm not so sure whether modeled version attributes are a good idea. How
> can we ensure that their values are confirming to CDO's interpretation?
>
> And if you want to exclude certain things (like modeled versions) I
> think it's better to write code that enforces the rule, not just docs ;-)
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 30.04.2010 15:07, schrieb Martin Taal:
>> Hi Aleksander,
>> Actually it should be supported that the version column is explicitly
>> modeled. But as you have noticed it is not tested that explicitly :-(.
>> I will re-open the issue as a trigger to look at it in more detail.
>>
>> CDO requires versions to be stored therefore Teneo will always create
>> a version column. The version can be obtained from the CDOObject on
>> the client also (if needed).
>>
>> gr. Martin
>>
>> Aleksander Bandelj wrote:
>>> To contradict myself yet again, no, not quite.
>>>
>>> I've discovered that CDO/Teneo adds always_version property if not
>>> present. This property adds version columns to mapping and they are used
>>> by Teneo/Hibernate even though not present in the model. My problem was
>>> that version attribute was in the model, not implicitly added by Teneo.
>>>
>>> Approach which seems to work OK is the same as in example model: no
>>> attributes with @Version annotations in model, but added implicitly
>>> through teneo property always_version (set by default).
>>>
>>> Actually, proper working of CDO/Teneo depends on versioning being
>>> present, as I discovered in HibernateStoreAccessor#write:
>>>
>>> // first decrease the version for all dirty objects
>>> // hibernate will increase it again
>>> for (CDORevision revision : context.getDirtyObjects())
>>> {
>>> if (revision instanceof InternalCDORevision)
>>> {
>>> InternalCDORevision internalRevision =
>>> (InternalCDORevision)revision;
>>> internalRevision.setVersion(internalRevision.getVersion() -
>>> 1);
>>> }
>>> }
>>>
>>>
>>> So, maybe more emphasis in documentation/FAQ that version columns are
>>> always needed and should not be put in model. I would put it there
>>> myself, but I am unable to log in eclipse wiki with my bugzilla user
>>> data :/
>>>
>>> -a
>>>
>>> On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
>>>> Sadly, I've discovered that's not nearly the whole story. Somehow using
>>>> version column makes CDO/Hibernate much more susceptible to "row was
>>>> already updated or deleted by other transaction" errors, which
>>>> frequently make resource unworkable until server restart. Without
>>>> version column, everything is fine. I've also noticed example model
>>>> doesn't use version column. I would put "do not use version for
>>>> CDO/Hibernate for time being" in FAQ. I've opened:
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>>>>
>>>> But I suspect such bugs might be hard to pin down, because you have
>>>> hibernate and CDO version concurrency clashing.
>>>>
>>>> -a
>>>>
>>>> On 04/29/2010 05:11 PM, Martin Taal wrote:
>>>>> Thanks for posting Aleksander! I have added it to the troubleshooting
>>>>> section:
>>>>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>>>>
>>>>>
>>>>>
>>>>> Feel free to adapt/add anyother comments there.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Aleksander Bandelj wrote:
>>>>>> Probably not worth a special case in the code, but will post here
>>>>>> because it might help someone . I have persistent class with version
>>>>>> attribute, which is located in mapped superclass. Default for this
>>>>>> attribute was -1 for some reason, which caused mysterious exception:
>>>
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: [CDO Teneo] Version column heisenbugs [message #530809 is a reply to message #530807] Sat, 01 May 2010 08:29 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030201050904010908000605
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Am 01.05.2010 09:59, schrieb Martin Taal:
> Hi Eike,
> I am not sure either :-). One specific reason to model it explicitly
> is that then the version is then part of the data when serializing to
> xml (and back) or for other integration scenarios.
Please note that in CDO 3.0 there is a new annotation to specify
transient/persistent independently from EMF's normal interpretation:

|/**
* @author Eike Stepper
* @since 2.0
*/
*public final class *EMFUtil
{
/**
* @since 3.0
*/
*public static final *String CDO_ANNOTATION_SOURCE =
"http://www.eclipse.org/emf/CDO";

/**
* @since 3.0
*/
*public static final *String CDO_ANNOTATION_KEY_PERSISTENT = "persistent";|


With this annotation you can for example exclude a specific structural
feature from being persisted in CDO, while it would still be persisted
to other resource types.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> But other than that the internal CDO version should work fine.
>
> I have added your comment to the bugzilla so that I won't overlook it
> when looking at the issue.
>
> gr. Martin
>
> Eike Stepper wrote:
>> Hey Guys,
>>
>> I'm not so sure whether modeled version attributes are a good idea.
>> How can we ensure that their values are confirming to CDO's
>> interpretation?
>>
>> And if you want to exclude certain things (like modeled versions) I
>> think it's better to write code that enforces the rule, not just docs
>> ;-)
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Am 30.04.2010 15:07, schrieb Martin Taal:
>>> Hi Aleksander,
>>> Actually it should be supported that the version column is
>>> explicitly modeled. But as you have noticed it is not tested that
>>> explicitly :-(. I will re-open the issue as a trigger to look at it
>>> in more detail.
>>>
>>> CDO requires versions to be stored therefore Teneo will always
>>> create a version column. The version can be obtained from the
>>> CDOObject on the client also (if needed).
>>>
>>> gr. Martin
>>>
>>> Aleksander Bandelj wrote:
>>>> To contradict myself yet again, no, not quite.
>>>>
>>>> I've discovered that CDO/Teneo adds always_version property if not
>>>> present. This property adds version columns to mapping and they are
>>>> used
>>>> by Teneo/Hibernate even though not present in the model. My problem
>>>> was
>>>> that version attribute was in the model, not implicitly added by
>>>> Teneo.
>>>>
>>>> Approach which seems to work OK is the same as in example model: no
>>>> attributes with @Version annotations in model, but added implicitly
>>>> through teneo property always_version (set by default).
>>>>
>>>> Actually, proper working of CDO/Teneo depends on versioning being
>>>> present, as I discovered in HibernateStoreAccessor#write:
>>>>
>>>> // first decrease the version for all dirty objects
>>>> // hibernate will increase it again
>>>> for (CDORevision revision : context.getDirtyObjects())
>>>> {
>>>> if (revision instanceof InternalCDORevision)
>>>> {
>>>> InternalCDORevision internalRevision =
>>>> (InternalCDORevision)revision;
>>>> internalRevision.setVersion(internalRevision.getVersion()
>>>> - 1);
>>>> }
>>>> }
>>>>
>>>>
>>>> So, maybe more emphasis in documentation/FAQ that version columns are
>>>> always needed and should not be put in model. I would put it there
>>>> myself, but I am unable to log in eclipse wiki with my bugzilla
>>>> user data :/
>>>>
>>>> -a
>>>>
>>>> On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
>>>>> Sadly, I've discovered that's not nearly the whole story. Somehow
>>>>> using
>>>>> version column makes CDO/Hibernate much more susceptible to "row was
>>>>> already updated or deleted by other transaction" errors, which
>>>>> frequently make resource unworkable until server restart. Without
>>>>> version column, everything is fine. I've also noticed example model
>>>>> doesn't use version column. I would put "do not use version for
>>>>> CDO/Hibernate for time being" in FAQ. I've opened:
>>>>>
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>>>>>
>>>>> But I suspect such bugs might be hard to pin down, because you have
>>>>> hibernate and CDO version concurrency clashing.
>>>>>
>>>>> -a
>>>>>
>>>>> On 04/29/2010 05:11 PM, Martin Taal wrote:
>>>>>> Thanks for posting Aleksander! I have added it to the
>>>>>> troubleshooting
>>>>>> section:
>>>>>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>>>>>
>>>>>>
>>>>>>
>>>>>> Feel free to adapt/add anyother comments there.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Aleksander Bandelj wrote:
>>>>>>> Probably not worth a special case in the code, but will post here
>>>>>>> because it might help someone . I have persistent class with
>>>>>>> version
>>>>>>> attribute, which is located in mapped superclass. Default for this
>>>>>>> attribute was -1 for some reason, which caused mysterious
>>>>>>> exception:
>>>>
>>>
>>>
>
>

--------------030201050904010908000605
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Am 01.05.2010 09:59, schrieb Martin Taal:
<blockquote cite="mid:hrgn0b$ga9$1@build.eclipse.org" type="cite">Hi
Eike,
<br>
I am not sure either :-). One specific reason to model it explicitly is
that then the version is then part of the data when serializing to xml
(and back) or for other integration scenarios.</blockquote>
Please note that in CDO 3.0 there is a new annotation to specify
transient/persistent independently from EMF's normal interpretation:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#3f5fbf">/**</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@author </font><font color="#3f5fbf">Eike Stepper</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@since </font><font color="#3f5fbf">2.0</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">*/</font><br>
<font color="#7f0055"><b>public final class </b></font><font
color="#000000">EMFUtil</font><br>
<font color="#000000">{</font><br>
<font color="#ffffff">  </font><font color="#3f5fbf">/**</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@since </font><font color="#3f5fbf">3.0</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">*/</font><br>
<font color="#ffffff">  </font><font color="#7f0055"><b>public static final </b></font><font
color="#000000">String CDO_ANNOTATION_SOURCE = </font> <font
color="#2a00ff"><a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/CDO">"http://www.eclipse.org/emf/CDO"</a></font><font
color="#000000">;</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff">  </font><font color="#3f5fbf">/**</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@since </font><font color="#3f5fbf">3.0</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">*/</font><br>
<font color="#ffffff">  </font><font color="#7f0055"><b>public static final </b></font><font
color="#000000">String CDO_ANNOTATION_KEY_PERSISTENT =  </font><font
color="#2a00ff">"persistent"</font><font color="#000000">;</font></code>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --><br>
With this annotation you can for example exclude a specific structural
feature from being persisted in CDO, while it would still be persisted
to other resource types.<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
<blockquote cite="mid:hrgn0b$ga9$1@build.eclipse.org" type="cite"> But
other than that the internal CDO version should work fine.
<br>
<br>
I have added your comment to the bugzilla so that I won't overlook it
when looking at the issue.
<br>
<br>
gr. Martin
<br>
<br>
Eike Stepper wrote:
<br>
<blockquote type="cite">Hey Guys,
<br>
<br>
I'm not so sure whether modeled version attributes are a good idea. How
can we ensure that their values are confirming to CDO's interpretation?
<br>
<br>
And if you want to exclude certain things (like modeled versions) I
think it's better to write code that enforces the rule, not just docs
;-)
<br>
<br>
Cheers
<br>
/Eike
<br>
<br>
----
<br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a>
<br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a>
<br>
<br>
<br>
<br>
Am 30.04.2010 15:07, schrieb Martin Taal:
<br>
<blockquote type="cite">Hi Aleksander,
<br>
Actually it should be supported that the version column is explicitly
modeled. But as you have noticed it is not tested that explicitly :-(.
I will re-open the issue as a trigger to look at it in more detail.
<br>
<br>
CDO requires versions to be stored therefore Teneo will always create a
version column. The version can be obtained from the CDOObject on the
client also (if needed).
<br>
<br>
gr. Martin
<br>
<br>
Aleksander Bandelj wrote:
<br>
<blockquote type="cite">To contradict myself yet again, no, not
quite.
<br>
<br>
I've discovered that CDO/Teneo adds always_version property if not
<br>
present. This property adds version columns to mapping and they are
used
<br>
by Teneo/Hibernate even though not present in the model. My problem was
<br>
that version attribute was in the model, not implicitly added by Teneo.
<br>
<br>
Approach which seems to work OK is the same as in example model: no
<br>
attributes with @Version annotations in model, but added implicitly
<br>
through teneo property always_version (set by default).
<br>
<br>
Actually, proper working of CDO/Teneo depends on versioning being
<br>
present, as I discovered in HibernateStoreAccessor#write:
<br>
<br>
      // first decrease the version for all dirty objects
<br>
      // hibernate will increase it again
<br>
      for (CDORevision revision : context.getDirtyObjects())
<br>
      {
<br>
        if (revision instanceof InternalCDORevision)
<br>
        {
<br>
          InternalCDORevision internalRevision =
<br>
(InternalCDORevision)revision;
<br>
          internalRevision.setVersion(internalRevision.getVersion() -
1);
<br>
        }
<br>
      }
<br>
<br>
<br>
So, maybe more emphasis in documentation/FAQ that version columns are
<br>
always needed and should not be put in model. I would put it there
<br>
myself, but I am unable to log in eclipse wiki with my bugzilla user
data :/
<br>
<br>
-a
<br>
<br>
On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
<br>
<blockquote type="cite">Sadly, I've discovered that's not
nearly the whole story. Somehow using
<br>
version column makes CDO/Hibernate much more susceptible to "row was
<br>
already updated or deleted by other transaction" errors, which
<br>
frequently make resource unworkable until server restart. Without
<br>
version column, everything is fine. I've also noticed example model
<br>
doesn't use version column. I would put "do not use version for
<br>
CDO/Hibernate for time being" in FAQ. I've opened:
<br>
<br>
<a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069">https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069</a>
<br>
<br>
But I suspect such bugs might be hard to pin down, because you have
<br>
hibernate and CDO version concurrency clashing.
<br>
<br>
-a
<br>
<br>
On 04/29/2010 05:11 PM, Martin Taal wrote:
<br>
<blockquote type="cite">Thanks for posting Aleksander! I have
added it to the troubleshooting
<br>
section:
<br>
<a class="moz-txt-link-freetext" href=" http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered"> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered</a>
<br>
<br>
<br>
Feel free to adapt/add anyother comments there.
<br>
<br>
gr. Martin
<br>
<br>
Aleksander Bandelj wrote:
<br>
<blockquote type="cite">Probably not worth a special case
in the code, but will post here
<br>
because it might help someone . I have persistent class with version
<br>
attribute, which is located in mapped superclass. Default for this
<br>
attribute was -1 for some reason, which caused mysterious exception:
<br>
</blockquote>
</blockquote>
</blockquote>
<br>
</blockquote>
<br>
<br>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
</body>
</html>

--------------030201050904010908000605--


Re: [CDO Teneo] Version column heisenbugs [message #530810 is a reply to message #530809] Sat, 01 May 2010 08:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060903020207040005030405
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

I forgot to mention that this annotation is also present in 2.0.x but
just not publicly. Let me know if you want more details on this.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 01.05.2010 10:29, schrieb Eike Stepper:
> Am 01.05.2010 09:59, schrieb Martin Taal:
>> Hi Eike,
>> I am not sure either :-). One specific reason to model it explicitly
>> is that then the version is then part of the data when serializing to
>> xml (and back) or for other integration scenarios.
> Please note that in CDO 3.0 there is a new annotation to specify
> transient/persistent independently from EMF's normal interpretation:
>
> |/**
> * @author Eike Stepper
> * @since 2.0
> */
> *public final class *EMFUtil
> {
> /**
> * @since 3.0
> */
> *public static final *String CDO_ANNOTATION_SOURCE =
> "http://www.eclipse.org/emf/CDO";
>
> /**
> * @since 3.0
> */
> *public static final *String CDO_ANNOTATION_KEY_PERSISTENT =
> "persistent";|
>
>
> With this annotation you can for example exclude a specific structural
> feature from being persisted in CDO, while it would still be persisted
> to other resource types.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>> But other than that the internal CDO version should work fine.
>>
>> I have added your comment to the bugzilla so that I won't overlook it
>> when looking at the issue.
>>
>> gr. Martin
>>
>> Eike Stepper wrote:
>>> Hey Guys,
>>>
>>> I'm not so sure whether modeled version attributes are a good idea.
>>> How can we ensure that their values are confirming to CDO's
>>> interpretation?
>>>
>>> And if you want to exclude certain things (like modeled versions) I
>>> think it's better to write code that enforces the rule, not just
>>> docs ;-)
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> Am 30.04.2010 15:07, schrieb Martin Taal:
>>>> Hi Aleksander,
>>>> Actually it should be supported that the version column is
>>>> explicitly modeled. But as you have noticed it is not tested that
>>>> explicitly :-(. I will re-open the issue as a trigger to look at it
>>>> in more detail.
>>>>
>>>> CDO requires versions to be stored therefore Teneo will always
>>>> create a version column. The version can be obtained from the
>>>> CDOObject on the client also (if needed).
>>>>
>>>> gr. Martin
>>>>
>>>> Aleksander Bandelj wrote:
>>>>> To contradict myself yet again, no, not quite.
>>>>>
>>>>> I've discovered that CDO/Teneo adds always_version property if not
>>>>> present. This property adds version columns to mapping and they
>>>>> are used
>>>>> by Teneo/Hibernate even though not present in the model. My
>>>>> problem was
>>>>> that version attribute was in the model, not implicitly added by
>>>>> Teneo.
>>>>>
>>>>> Approach which seems to work OK is the same as in example model: no
>>>>> attributes with @Version annotations in model, but added implicitly
>>>>> through teneo property always_version (set by default).
>>>>>
>>>>> Actually, proper working of CDO/Teneo depends on versioning being
>>>>> present, as I discovered in HibernateStoreAccessor#write:
>>>>>
>>>>> // first decrease the version for all dirty objects
>>>>> // hibernate will increase it again
>>>>> for (CDORevision revision : context.getDirtyObjects())
>>>>> {
>>>>> if (revision instanceof InternalCDORevision)
>>>>> {
>>>>> InternalCDORevision internalRevision =
>>>>> (InternalCDORevision)revision;
>>>>>
>>>>> internalRevision.setVersion(internalRevision.getVersion() - 1);
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>> So, maybe more emphasis in documentation/FAQ that version columns are
>>>>> always needed and should not be put in model. I would put it there
>>>>> myself, but I am unable to log in eclipse wiki with my bugzilla
>>>>> user data :/
>>>>>
>>>>> -a
>>>>>
>>>>> On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
>>>>>> Sadly, I've discovered that's not nearly the whole story. Somehow
>>>>>> using
>>>>>> version column makes CDO/Hibernate much more susceptible to "row was
>>>>>> already updated or deleted by other transaction" errors, which
>>>>>> frequently make resource unworkable until server restart. Without
>>>>>> version column, everything is fine. I've also noticed example model
>>>>>> doesn't use version column. I would put "do not use version for
>>>>>> CDO/Hibernate for time being" in FAQ. I've opened:
>>>>>>
>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>>>>>>
>>>>>> But I suspect such bugs might be hard to pin down, because you have
>>>>>> hibernate and CDO version concurrency clashing.
>>>>>>
>>>>>> -a
>>>>>>
>>>>>> On 04/29/2010 05:11 PM, Martin Taal wrote:
>>>>>>> Thanks for posting Aleksander! I have added it to the
>>>>>>> troubleshooting
>>>>>>> section:
>>>>>>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Feel free to adapt/add anyother comments there.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Aleksander Bandelj wrote:
>>>>>>>> Probably not worth a special case in the code, but will post here
>>>>>>>> because it might help someone . I have persistent class with
>>>>>>>> version
>>>>>>>> attribute, which is located in mapped superclass. Default for this
>>>>>>>> attribute was -1 for some reason, which caused mysterious
>>>>>>>> exception:
>>>>>
>>>>
>>>>
>>
>>

--------------060903020207040005030405
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I forgot to mention that this annotation is also present in 2.0.x but
just not publicly. Let me know if you want more details on this.<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
<br>
Am 01.05.2010 10:29, schrieb Eike Stepper:
<blockquote cite="mid:hrgoot$s01$2@build.eclipse.org" type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
Am 01.05.2010 09:59, schrieb Martin Taal:
<blockquote cite="mid:hrgn0b$ga9$1@build.eclipse.org" type="cite">Hi
Eike, <br>
I am not sure either :-). One specific reason to model it explicitly is
that then the version is then part of the data when serializing to xml
(and back) or for other integration scenarios.</blockquote>
Please note that in CDO 3.0 there is a new annotation to specify
transient/persistent independently from EMF's normal interpretation:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = --><!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#3f5fbf">/**</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@author </font><font color="#3f5fbf">Eike Stepper</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@since </font><font color="#3f5fbf">2.0</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">*/</font><br>
<font color="#7f0055"><b>public final class </b></font><font
color="#000000">EMFUtil</font><br>
<font color="#000000">{</font><br>
<font color="#ffffff">  </font><font color="#3f5fbf">/**</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@since </font><font color="#3f5fbf">3.0</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">*/</font><br>
<font color="#ffffff">  </font><font color="#7f0055"><b>public static final </b></font><font
color="#000000">String CDO_ANNOTATION_SOURCE = </font> <font
color="#2a00ff"><a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://www.eclipse.org/emf/CDO">"http://www.eclipse.org/emf/CDO"</a></font><font
color="#000000">;</font><br>
<br>
<font color="#ffffff">  </font><font color="#3f5fbf">/**</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@since </font><font color="#3f5fbf">3.0</font><br>
<font color="#ffffff">   </font><font color="#3f5fbf">*/</font><br>
<font color="#ffffff">  </font><font color="#7f0055"><b>public static final </b></font><font
color="#000000">String CDO_ANNOTATION_KEY_PERSISTENT =  </font><font
color="#2a00ff">"persistent"</font><font color="#000000">;</font></code>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --><br>
With this annotation you can for example exclude a specific structural
feature from being persisted in CDO, while it would still be persisted
to other resource types.<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
<blockquote cite="mid:hrgn0b$ga9$1@build.eclipse.org" type="cite">
But
other than that the internal CDO version should work fine. <br>
<br>
I have added your comment to the bugzilla so that I won't overlook it
when looking at the issue. <br>
<br>
gr. Martin <br>
<br>
Eike Stepper wrote: <br>
<blockquote type="cite">Hey Guys, <br>
<br>
I'm not so sure whether modeled version attributes are a good idea. How
can we ensure that their values are confirming to CDO's interpretation?
<br>
<br>
And if you want to exclude certain things (like modeled versions) I
think it's better to write code that enforces the rule, not just docs
;-) <br>
<br>
Cheers <br>
/Eike <br>
<br>
---- <br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a>
<br>
<br>
<br>
<br>
Am 30.04.2010 15:07, schrieb Martin Taal: <br>
<blockquote type="cite">Hi Aleksander, <br>
Actually it should be supported that the version column is explicitly
modeled. But as you have noticed it is not tested that explicitly :-(.
I will re-open the issue as a trigger to look at it in more detail. <br>
<br>
CDO requires versions to be stored therefore Teneo will always create a
version column. The version can be obtained from the CDOObject on the
client also (if needed). <br>
<br>
gr. Martin <br>
<br>
Aleksander Bandelj wrote: <br>
<blockquote type="cite">To contradict myself yet again, no, not
quite. <br>
<br>
I've discovered that CDO/Teneo adds always_version property if not <br>
present. This property adds version columns to mapping and they are
used <br>
by Teneo/Hibernate even though not present in the model. My problem was
<br>
that version attribute was in the model, not implicitly added by Teneo.
<br>
<br>
Approach which seems to work OK is the same as in example model: no <br>
attributes with @Version annotations in model, but added implicitly <br>
through teneo property always_version (set by default). <br>
<br>
Actually, proper working of CDO/Teneo depends on versioning being <br>
present, as I discovered in HibernateStoreAccessor#write: <br>
<br>
      // first decrease the version for all dirty objects <br>
      // hibernate will increase it again <br>
      for (CDORevision revision : context.getDirtyObjects()) <br>
      { <br>
        if (revision instanceof InternalCDORevision) <br>
        { <br>
          InternalCDORevision internalRevision = <br>
(InternalCDORevision)revision; <br>
          internalRevision.setVersion(internalRevision.getVersion() -
1); <br>
        } <br>
      } <br>
<br>
<br>
So, maybe more emphasis in documentation/FAQ that version columns are <br>
always needed and should not be put in model. I would put it there <br>
myself, but I am unable to log in eclipse wiki with my bugzilla user
data :/ <br>
<br>
-a <br>
<br>
On 04/29/2010 07:18 PM, Aleksander Bandelj wrote: <br>
<blockquote type="cite">Sadly, I've discovered that's not
nearly the whole story. Somehow using <br>
version column makes CDO/Hibernate much more susceptible to "row was <br>
already updated or deleted by other transaction" errors, which <br>
frequently make resource unworkable until server restart. Without <br>
version column, everything is fine. I've also noticed example model <br>
doesn't use version column. I would put "do not use version for <br>
CDO/Hibernate for time being" in FAQ. I've opened: <br>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069">https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069</a>
<br>
<br>
But I suspect such bugs might be hard to pin down, because you have <br>
hibernate and CDO version concurrency clashing. <br>
<br>
-a <br>
<br>
On 04/29/2010 05:11 PM, Martin Taal wrote: <br>
<blockquote type="cite">Thanks for posting Aleksander! I
have
added it to the troubleshooting <br>
section: <br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href=" http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered"> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered</a>
<br>
<br>
<br>
Feel free to adapt/add anyother comments there. <br>
<br>
gr. Martin <br>
<br>
Aleksander Bandelj wrote: <br>
<blockquote type="cite">Probably not worth a special case
in the code, but will post here <br>
because it might help someone . I have persistent class with version <br>
attribute, which is located in mapped superclass. Default for this <br>
attribute was -1 for some reason, which caused mysterious exception: <br>
</blockquote>
</blockquote>
</blockquote>
<br>
</blockquote>
<br>
<br>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
</blockquote>
</body>
</html>

--------------060903020207040005030405--


Re: [CDO Teneo] Version column heisenbugs [message #530813 is a reply to message #530810] Sat, 01 May 2010 09:14 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
What I mean is that normally the cdo version is a cdo internal property (so not an efeature) so it won't be persisted to
xml. Afaics, there is only one reason to model the version explicitly in the model also (to persist it to other targets
than CDO).

gr. Martin

Eike Stepper wrote:
> I forgot to mention that this annotation is also present in 2.0.x but
> just not publicly. Let me know if you want more details on this.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 01.05.2010 10:29, schrieb Eike Stepper:
>> Am 01.05.2010 09:59, schrieb Martin Taal:
>>> Hi Eike,
>>> I am not sure either :-). One specific reason to model it explicitly
>>> is that then the version is then part of the data when serializing to
>>> xml (and back) or for other integration scenarios.
>> Please note that in CDO 3.0 there is a new annotation to specify
>> transient/persistent independently from EMF's normal interpretation:
>>
>> |/**
>> * @author Eike Stepper
>> * @since 2.0
>> */
>> *public final class *EMFUtil
>> {
>> /**
>> * @since 3.0
>> */
>> *public static final *String CDO_ANNOTATION_SOURCE = "http://www.eclipse.org/emf/CDO";
>>
>> /**
>> * @since 3.0
>> */
>> *public static final *String CDO_ANNOTATION_KEY_PERSISTENT = "persistent";|
>>
>>
>>
>> With this annotation you can for example exclude a specific structural
>> feature from being persisted in CDO, while it would still be persisted
>> to other resource types.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>> But other than that the internal CDO version should work fine.
>>>
>>> I have added your comment to the bugzilla so that I won't overlook it
>>> when looking at the issue.
>>>
>>> gr. Martin
>>>
>>> Eike Stepper wrote:
>>>> Hey Guys,
>>>>
>>>> I'm not so sure whether modeled version attributes are a good idea.
>>>> How can we ensure that their values are confirming to CDO's
>>>> interpretation?
>>>>
>>>> And if you want to exclude certain things (like modeled versions) I
>>>> think it's better to write code that enforces the rule, not just
>>>> docs ;-)
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> Am 30.04.2010 15:07, schrieb Martin Taal:
>>>>> Hi Aleksander,
>>>>> Actually it should be supported that the version column is
>>>>> explicitly modeled. But as you have noticed it is not tested that
>>>>> explicitly :-(. I will re-open the issue as a trigger to look at it
>>>>> in more detail.
>>>>>
>>>>> CDO requires versions to be stored therefore Teneo will always
>>>>> create a version column. The version can be obtained from the
>>>>> CDOObject on the client also (if needed).
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Aleksander Bandelj wrote:
>>>>>> To contradict myself yet again, no, not quite.
>>>>>>
>>>>>> I've discovered that CDO/Teneo adds always_version property if not
>>>>>> present. This property adds version columns to mapping and they
>>>>>> are used
>>>>>> by Teneo/Hibernate even though not present in the model. My
>>>>>> problem was
>>>>>> that version attribute was in the model, not implicitly added by
>>>>>> Teneo.
>>>>>>
>>>>>> Approach which seems to work OK is the same as in example model: no
>>>>>> attributes with @Version annotations in model, but added implicitly
>>>>>> through teneo property always_version (set by default).
>>>>>>
>>>>>> Actually, proper working of CDO/Teneo depends on versioning being
>>>>>> present, as I discovered in HibernateStoreAccessor#write:
>>>>>>
>>>>>> // first decrease the version for all dirty objects
>>>>>> // hibernate will increase it again
>>>>>> for (CDORevision revision : context.getDirtyObjects())
>>>>>> {
>>>>>> if (revision instanceof InternalCDORevision)
>>>>>> {
>>>>>> InternalCDORevision internalRevision =
>>>>>> (InternalCDORevision)revision;
>>>>>>
>>>>>> internalRevision.setVersion(internalRevision.getVersion() - 1);
>>>>>> }
>>>>>> }
>>>>>>
>>>>>>
>>>>>> So, maybe more emphasis in documentation/FAQ that version columns are
>>>>>> always needed and should not be put in model. I would put it there
>>>>>> myself, but I am unable to log in eclipse wiki with my bugzilla
>>>>>> user data :/
>>>>>>
>>>>>> -a
>>>>>>
>>>>>> On 04/29/2010 07:18 PM, Aleksander Bandelj wrote:
>>>>>>> Sadly, I've discovered that's not nearly the whole story. Somehow
>>>>>>> using
>>>>>>> version column makes CDO/Hibernate much more susceptible to "row was
>>>>>>> already updated or deleted by other transaction" errors, which
>>>>>>> frequently make resource unworkable until server restart. Without
>>>>>>> version column, everything is fine. I've also noticed example model
>>>>>>> doesn't use version column. I would put "do not use version for
>>>>>>> CDO/Hibernate for time being" in FAQ. I've opened:
>>>>>>>
>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=311069
>>>>>>>
>>>>>>> But I suspect such bugs might be hard to pin down, because you have
>>>>>>> hibernate and CDO version concurrency clashing.
>>>>>>>
>>>>>>> -a
>>>>>>>
>>>>>>> On 04/29/2010 05:11 PM, Martin Taal wrote:
>>>>>>>> Thanks for posting Aleksander! I have added it to the
>>>>>>>> troubleshooting
>>>>>>>> section:
>>>>>>>> http://wiki.eclipse.org/CDO_Hibernate_Store_Trouble_Shooting #Error_Rollback:_revision_was_not_registered
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Feel free to adapt/add anyother comments there.
>>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Aleksander Bandelj wrote:
>>>>>>>>> Probably not worth a special case in the code, but will post here
>>>>>>>>> because it might help someone . I have persistent class with
>>>>>>>>> version
>>>>>>>>> attribute, which is located in mapped superclass. Default for this
>>>>>>>>> attribute was -1 for some reason, which caused mysterious
>>>>>>>>> exception:
>>>>>>
>>>>>
>>>>>
>>>
>>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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:automatic assignment of generated UUID to attribute with property ID=true [intrinsic]
Next Topic:EMF + DataBinding + Master/Detail problem
Goto Forum:
  


Current Time: Wed Apr 24 17:55:12 GMT 2024

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

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

Back to the top