-
1. Re: How to insert data more than one time for a single entity ?
sart Feb 25, 2008 4:54 PM (in response to sart)hmm.. i create same topic twice /
i'm sorry, i thought it didn't save first time.. -
2. Re: How to insert data more than one time for a single entity ?
laliluna.usenet.laliluna.de Feb 25, 2008 5:02 PM (in response to sart)Your object will have an ID once it was saved. In that case, you can call merge instead.
You might read about merge and persist in the doc as well.Regards
Sebastian
-
3. Re: How to insert data more than one time for a single entity ?
sart Feb 25, 2008 5:10 PM (in response to sart)Thank you for your reply but the problem is that i don't need to change saved data, but to insert, for example six different lines of data into database with one method.
-
4. Re: How to insert data more than one time for a single entity ?
keithnaas Feb 25, 2008 5:25 PM (in response to sart)You need to make sure that you instantiate a new Schedule object each time you want a new one saved. Otherwise, the previously saved Schedule with its own ID will simply attempt to persist again.
-
5. Re: How to insert data more than one time for a single entity ?
sart Feb 25, 2008 5:40 PM (in response to sart)
Keith Naas wrote on Feb 25, 2008 05:25 PM:
You need to make sure that you instantiate a new Schedule object each time you want a new one saved. Otherwise, the previously saved Schedule with its own ID will simply attempt to persist again.But how to instantiate a new Schedule object if
Schedule schedule = new Schedule()
is not working ?
-
6. Re: How to insert data more than one time for a single entity ?
dustismo Feb 25, 2008 6:58 PM (in response to sart)Obviously every named component can only have one instance in a given context, so using @In is probably not what you want to do..
What do you mean that
Schedule schedule = new Schedule()
doesn't work? How are you calling persist? What exception is thrown?
-Dustin