What does your code look like? Are you opening a session and starting a transaction, then after you create your object are you calling saveOrUpdate() in the Session object or if using JPA calling persist(), then after that committing the transaction?
Please post your code. (Use the code button below to keep the formatting and indentation of code)
You might also want to make sure you're catching any exceptions and gathering information from them. You should be getting some feedback if your code isn't working. Do you know that the code is even being encountered?