I have one object called message and another 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 those frames, but before, I need to save that message object.
How can I do this?
Here is the code for my ManagedBean, in which I now want 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();
}