save an object list

0

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();

        }
    
asked by anonymous 22.06.2015 / 14:41

1 answer

0

Create the logic to save a frame and then do it:

messageFacade.save(message);
for(Frame f: listAllFrames){
   frameFacade.save(f);
}
    
22.06.2015 / 21:39