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 <pavelby...@gmail.com> wrote:

> anyone?
>
>
> On Wed, Jun 8, 2011 at 10:46 PM, Pavel Byles <pavelby...@gmail.com> 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 google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> 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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to