This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi all, I am new to hibernate and started practicing from yesterday. I tried with a simple insertion, selection code. Later thought to try a foreign key insertion. This is the code I used to insert records in 2 tables which has a foreign key.
Author.hbm.xmlAuthor.javaBook.javaExample.javaThe records are being successfully inserted.
My problem starts here. Suppose I want to insert another book for the same author. I am using the following approach.
I am taking the author's id and his name, then setting the Author.java POJO class and then setting name and author of the Book.java POJO class and then executing the program. The records are being successfully inserted. The problem is I have to set all details for Author.java POJO. If am not setting author.setName(String) a NULL is being inserted.
How to add a record in the child table without having to change the record in the parent table.
Hope you all understood my problem. Can anyone please shed some light on this issue. Thank you all in advance.