Ignore @NotNull on JPA's @GeneratedValue properties for pre-persist operations

Description

When using NetBeans 7 to generate entity classes from a database table, the entity classes are generated with the following annotations...

When persisting, bean validation fails because the autogenerated primary key is null at the time the object is persisted.

Netbeans have stated that they wont fix this as they see it as bean validation issue rather than their generated classes.

See here: http://netbeans.org/bugzilla/show_bug.cgi?id=197845

Related Forum posting is here...

https://forum.hibernate.org/viewtopic.php?f=9&t=1011908

Suggest modifying Bean Validation Pre-Persist to ignore @NotNull if @GeneratedValue exists.

Thanks
Rich

Environment

Netbeans 7, Seam 3 under JBOSS AS 7

Assignee

Unassigned

Reporter

Richard Clarke

Labels

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

Pull Request

None

backportDecision

None

backportReEvaluate

None

Time tracking

8h

Components

Affects versions

Priority

Minor
Configure