This issue can't be edited

Because it belongs to an archived project. Jira admins can restore projects from the archive.

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

Activity

Show:

Emmanuel Bernard February 17, 2013 at 7:20 PM

Let's experiment with before moving it up at the spec levels.

Emmanuel Bernard May 15, 2012 at 10:21 AM

I have worked out a proposal at http://beanvalidation.org/proposals/BVAL-234/

David Konecny May 15, 2012 at 12:57 AM

FYI: I commented in NetBeans issue why I think this should be resolved on JPA side - http://netbeans.org/bugzilla/show_bug.cgi?id=197845#c3
It is possible I'm completely wrong here as spec is not very clear to me. Until we reach a consensus I suggest NetBeans do not generate @NotNull constraint as it is causing more harm than help.

Emmanuel Bernard September 26, 2011 at 11:23 PM

Even if right, how do ignore @NotNull when JPA's provider calls Bean Validation? A generic contract to ignore some constraint annotations based on property name?

Emmanuel Bernard September 26, 2011 at 11:18 PM

I'll raise the issue with the JPA expert group but I am not certain I agree with the NetBeans team on this.

Details

Assignee

Reporter

Participants

David Konecny
Emmanuel Bernard
Richard Clarke

Original estimate

Time tracking

No time logged8h remaining

Components

Affects versions

Priority

Created July 20, 2011 at 6:49 PM
Updated February 14, 2014 at 11:19 AM