Thanks for the reply Magno,
I have initialized just like that already.

Also, the values in my datastore are also initialized to 0.

On Thu, Jun 9, 2011 at 3:14 PM, Magno Machado <[email protected]> wrote:

> I had this issue too.
>
> As far as I could see, the version field isn't initialized automaticaly.
> But once it has a value, it will be automaticaly incremented everytime you
> persist the entity.
>
> So what I did was simply initialize the version field to zero during entity
> instantiation.
>
> All my entities inherit from BaseEntity, which I declared as folow (It's
> annotated for use with JPA):
> @MappedSuperclass
> public class BaseEntity {
>  @Id
>  private Long id;
>
> @NotNull
> @Version
>  private Integer version = 0;
> }
>
> On Thu, Jun 9, 2011 at 5:00 PM, Pavel Byles <[email protected]> wrote:
>
>> anyone?
>>
>>
>> On Wed, Jun 8, 2011 at 10:46 PM, Pavel Byles <[email protected]>wrote:
>>
>>> I'm getting the following error when I'm using requestfactory with
>>> locators:
>>>
>>>
>>> The persisted entity with id 152 has a null version
>>>
>>> I have a version column in my datastore and the following in my Entity:
>>>
>>>
>>> public Integer getVersion() {
>>>
>>>   return this.version;
>>>
>>> }
>>>
>>>
>>> public void setVersion(Integer version) {
>>>
>>>   this.version = version;
>>>
>>> }
>>>
>>> I also have this in my locator:
>>>
>>> @Override
>>>
>>> public Object getVersion(Country domainObject) {
>>>
>>>   return domainObject.getVersion();
>>>
>>> }
>>>
>>> If I return 1 all the time for getVersion, everything works fine.
>>>
>>> I have looked at all the examples I could but there aren't many and tried
>>> to figure this out for a while. Things look right but doesn't seem to work.
>>>
>>> Any ideas?
>>>
>>> --
>>> -Pav
>>>
>>>
>>
>>
>> --
>> -Pav
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>
>
> --
> Magno Machado Paulo
> http://blog.magnomachado.com.br
> http://code.google.com/p/emballo/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
-Pav

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to