Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Inconsistent EntityManager.persist: Is this a failure in the TCK?

Well, it is not only nullable validation, it is also a problem with @Id
validation, if I write this code:


@Entity
public class Customer {

private Long id;
private String name;

@Id
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@Column(nullable=false)
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}

Note that the id field no longer has a @GeneratedValue annotation, it also
crashes at entityManager.persist in Hibernate but at
em.getTransaction().commit() in EclipseLink...

This is specially bad if the class has a compound primary key, because it
means it can not be "cascade saved" if the elements of the compound key are
also foreign keys that link to objects that have never been persisted to the
database...

-- 
View this message in context: http://www.nabble.com/Inconsistent-EntityManager.persist%3A-Is-this-a-failure-in-the-TCK--tp22599288p22608411.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top