I have my classes as below
I just took a glance at all that code, I didnt go in the details but according to your hibernate logs ,
Hibernate: create table Phone (phoneNumber varchar(255) not null, color varchar(255), id integer not null, primary key (phoneNumber, id))
The table Phone is created with coloumn 'id' as not null , however when inserting a new record in the this table you are doing it like
Hibernate will be expecting that you specify an appropriate value for couloumn 'id' as well otherwise it will fail at the binding process like it is as seen in your logs below
5:09:29,367 DEBUG SQL:104 - insert into Phone (color, phoneNumber, id) values (?, ?, ?)
15:09:29,369 TRACE BasicBinder:84 - binding parameter  as [VARCHAR] - Black
15:09:29,370 TRACE BasicBinder:84 - binding parameter  as [VARCHAR] - 1111111111
15:09:29,371 TRACE BasicBinder:72 - binding parameter  as [INTEGER] - <null>
15:09:29,376 WARN SqlExceptionHelper:145 - SQL Error: 1048, SQLState: 23000
15:09:29,377 ERROR SqlExceptionHelper:147 - Column 'id' cannot be null
15:09:29,393 INFO AbstractBatchImpl:195 - HHH000010: On release of batch it still contained JDBC statements
Thanks for your reply but shouldn't id column value of Phone table be auto inserted from the student table id value? Its a foreign key to the student table too.
Hibernate: alter table Phone add index FK_aoj0eivd0ap3drxnoyk4xj10q (id), add constraint FK_aoj0eivd0ap3drxnoyk4xj10q foreign key (id) references Student (id)
I want all the inserts to happen from the student side and not from both sides. How do I make this happen?