Hi,
I'm using annotations and hbm2ddl. I'm having a problem with the outputted alter table statement:
It outputs:
Code:
alter table tdrs.Reservation
add constraint FK63EEBAC662D7DD8
foreign key (empNo)
references tdrs.User;
But mysql will not let me execute that statement, giving the message
Code:
Can't create table '.\tdrs\#sql-5bc_518.frm' (errno: 150)
My annotated classes are:
Code:
@Entity
public class User
{
@Id
private String empNo;
private String firstName;
private String lastName;
private Timestamp dateModified;
private Timestamp dateAdded;
}
Code:
@Entity
public class Reservation
{
@Id
private Long reservationId;
@ManyToOne(cascade = ALL)
@JoinColumn(name = "empNo", referencedColumnName = "empNo")
private User user;
//other data
}
I've tried all sorts of other formats for the joinColumn annotation as well, but with no success.
The way that I can get mysql to execute the statement is by manually changing it to
Code:
alter table tdrs.Reservation
add constraint FK63EEBAC662D7DD8
foreign key (empNo)
references tdrs.User [b](empNo)[/b];
Is there any way to force hbm2ddl to assign the bit in bold above? Or am I missing something else?
Cheers.
[/quote][/code]