[jboss-user] [EJB 3.0] - Re: Foreign keys with 0 and not NULL
lafr
do-not-reply at jboss.com
Fri Sep 14 04:39:23 EDT 2007
The ID-field of MbiMsgss is of type Integer:
@Entity
| @Table(name="mbi_msgss")
| public class MbiMsgss implements java.io.Serializable
| {
| @Id
| @GeneratedValue(strategy=GenerationType.IDENTITY)
| @Column(name="msgss_serial")
| private java.lang.Integer msgssSerial;
| ...
|
The problem is, that our legacy app fills in a zero instead of a null into the database table field which works as a foreign key field.
So when I access the entity which has a OneToOne relation (uni-directional) to the above, I get that exception.
@Entity
| @IdClass(value=MbiMsgdi.PK.class)
| @Table(name="mbi_msgdi")
| public class MbiMsgdi implements java.io.Serializable
| {
| @Id
| @Column(name="bp_id")
| private java.lang.Integer bpId;
|
| @Id
| @Column(name="seq_no")
| private java.lang.Integer seqNo;
| ....
|
| @OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
| @JoinColumns({
| @JoinColumn(name="msgss_serial",referencedColumnName="msgss_serial",insertable=false,updatable=false)
| })
| private MbiMsgss mbiMsgss;
| ...
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084338#4084338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084338
More information about the jboss-user
mailing list