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?

HI Francisco,

These are all things that it would be a good idea to feed back to the spec committee.

As far as EclipseLink is concerned, are there any issues related to this that we can help you with?

-Tom


Francisco Peredo wrote:
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...



Back to the top