Details
Assignee
UnassignedUnassignedReporter
Richard ClarkeRichard ClarkeLabels
Participants
David KonecnyEmmanuel BernardRichard ClarkeOriginal estimate
8hTime tracking
No time logged8h remainingComponents
Affects versions
Priority
Minor
Details
Details
Assignee
Unassigned
UnassignedReporter
Richard Clarke
Richard ClarkeLabels
Participants
David Konecny
Emmanuel Bernard
Richard Clarke
Original estimate
8h
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
When using NetBeans 7 to generate entity classes from a database table, the entity classes are generated with the following annotations...
public class Orders implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @NotNull @Column(name = "orderid") private Integer orderid; // ... }
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