Generate SQL when Dynamic Update is true is including version field even when marked as updateable=false

Description

If an entity has the annotation:

@Enitity(dynamicUpdate=true)

And a field annotated as :

@Version
@Generated(GenerationTime.Always)
@Column(updateable=false, insertable=false)

The generated update sql will include the annotated field in the properties to be updated. This is incorrect and causes exceptions in certain cases. E.g updating a view where the resulting columns cross multiple tables.

When the dynamicUpdate is set to true, the sql string is generated dynamically and initially the field marked as updateable=false is flagged as not to be included. The AbstractEntityPersiter.getPropertiesToUpdate method then checks if there is a versioning field, finds the above annotated column and now flags it to be included, neglecting to check whether this versioning field has also been marked as updateable=false, or whether @Generated(GenerationTime.ALWAYS) is there. (Although the last isn't really necessary as this annotation can't be there without the column being marked as not updateable and not insertable.)

Environment

None

Activity

Show:
Gail Badner
January 24, 2009, 1:26 AM

Hi Dave,

Please resolve this issue if you are through with it.

Thanks,
Gail

Paul Benedict
January 27, 2009, 5:25 PM

What version was this fixed for?

Dave Stephan
January 28, 2009, 12:07 AM

fixed in trunk / 3.3 / 3.2 / 3.2cp

Steve Ebersole
March 21, 2011, 7:05 PM

Bulk closing stale resolved issues

Fixed

Assignee

Dave Stephan

Reporter

Dave Stephan

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure