0
I have an object called message and another one called frames.. That is, in my application I can have a list of frames related to the same message. I already have this list in my ManagedBean
, now I need to save these frames, but first I need to save this message object.
How can I do that?
Here is the code of my Managedbean, in which I now wish to save:
public void insert() {
try {
System.out.println(" --- " + listAllFrames.size());
if (message.getName().equals("")) {
MessageGrowl.warn(MessageProperties.getString("message.verify.title"));
} else if (message.getCategory() == null) {
MessageGrowl.warn(MessageProperties.getString("message.verify.category"));
} else if (message.getType() == null) {
MessageGrowl.warn(MessageProperties.getString("message.verify.type"));
} else if (listAllFrames == null) {
MessageGrowl.warn(MessageProperties.getString("message.verify.frame"));
} else {
message.setUser(user);
messageFacade.save(message);
MessageGrowl.info(MessageProperties.getString("message.sucessoMessage"));
clear();
}