hi,
Im having this problem with my project:
public class Meeting implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
....
with relationship
@OneToMany(cascade = CascadeType.ALL, mappedBy = "meeting1", fetch =
FetchType.LAZY)
private Collection<Document> documentCollection;
and the Document entity:
public class Document implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected DocumentPK documentPK;
....
@JoinColumn(name = "Meeting", referencedColumnName = "ID", insertable =
false, updatable = false)
@ManyToOne(optional = false, cascade=CascadeType.ALL)
private Meeting meeting1;
and documentPK
@Embeddable
public class DocumentPK implements Serializable {
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false, fetch=FetchType.EAGER)
@Column(name = "Meeting", nullable=false)
private Integer meeting;
problem is when i create a meeting and add some documents to it I get the
exception:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs
(12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Column 'Meeting' cannot be null
Error Code: 1048
Call: INSERT INTO DOCUMENT (Name, Note, File, FileName, ID, Meeting) VALUES
(?, ?, ?, ?, ?, ?)
bind => [null, null, [B_at_fbb498, j2ee_books.part2.rar, null, null]
Query:
InsertObjectQuery(org.ipo.mm.ejb.entities.Document[documentPK=org.ipo.mm.ejb.entities.DocumentPK[id=null,
meeting=null]])
usgin glassfish v2, mysql 5.0 on fedora 10
any ideas?
--
View this message in context: http://www.nabble.com/Toplink-cascade-with-embedded-id-and-autoincrement-tp24886752p24886752.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.